drawstatic.cpp

来自「VC&Matlab混合编程实现无线电导航指示器」· C++ 代码 · 共 72 行

CPP
72
字号
// DrawStatic.cpp : implementation file
//

#include "stdafx.h"
#include "RADIO.h"
#include "DrawStatic.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDrawStatic

CDrawStatic::CDrawStatic()
{m_paintProc=NULL;
m_strPaintInfo="";
}

CDrawStatic::~CDrawStatic()
{
}


BEGIN_MESSAGE_MAP(CDrawStatic, CStatic)
	//{{AFX_MSG_MAP(CDrawStatic)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDrawStatic message handlers

void CDrawStatic::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	Paint();
   //CStatic::OnPaint();
}

void CDrawStatic::SetPaintProc(PAINTPROCSTATIC paintProc){
m_paintProc=paintProc;
}

void CDrawStatic::SetPaintInfo(CString strPaintInfo)
{
m_strPaintInfo=strPaintInfo;
}

void CDrawStatic::Paint()
{   
	CDC *pDC=GetDC();
	m_paintProc(pDC,m_strPaintInfo);
	ReleaseDC(pDC);//不调用会死的很惨!
}

BOOL CDrawStatic::IsReadyToPaint()
{
return (m_paintProc!=NULL);
}


BOOL CDrawStatic::PreCreateWindow(CREATESTRUCT& cs) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CStatic::PreCreateWindow(cs);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?