www.pudn.com > buildct.zip > DrawPanel.cpp, change:2004-02-21,size:2726b


// DrawPanel.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "buildct.h" 
#include "DrawPanel.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
 
#define DRAWPANEL_CLASSNAME    _T("MFCDrawPanelCtrl")  // Window class name 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CDrawPanel 
 
CDrawPanel::CDrawPanel() 
{ 
	RegisterWindowClass(); 
} 
 
CDrawPanel::~CDrawPanel() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CDrawPanel, CWnd) 
	//{{AFX_MSG_MAP(CDrawPanel) 
	ON_WM_ACTIVATE() 
	ON_WM_ERASEBKGND() 
	ON_WM_PAINT() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CDrawPanel message handlers 
 
void CDrawPanel::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)  
{ 
	CWnd::OnActivate(nState, pWndOther, bMinimized); 
	 
	// TODO: Add your message handler code here 
	 
} 
 
void CDrawPanel::PreSubclassWindow()  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	 
	CWnd::PreSubclassWindow(); 
} 
 
BOOL CDrawPanel::OnEraseBkgnd(CDC* pDC)  
{ 
	// TODO: Add your message handler code here and/or call default 
	 
	return CWnd::OnEraseBkgnd(pDC); 
} 
 
void CDrawPanel::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
	 
	// TODO: Add your message handler code here 
	dc.TextOut (0,0,"good"); 
	// Do not call CWnd::OnPaint() for painting messages 
} 
 
BOOL CDrawPanel::RegisterWindowClass() 
{ 
	WNDCLASS wndcls; 
    HINSTANCE hInst = AfxGetInstanceHandle(); 
 
    if (!(::GetClassInfo(hInst, DRAWPANEL_CLASSNAME, &wndcls))) 
    { 
        // otherwise we need to register a new class 
        wndcls.style            = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; 
        wndcls.lpfnWndProc      = ::DefWindowProc; 
        wndcls.cbClsExtra       = wndcls.cbWndExtra = 0; 
        wndcls.hInstance        = hInst; 
        wndcls.hIcon            = NULL; 
        wndcls.hCursor          = AfxGetApp()->LoadStandardCursor(IDC_ARROW); 
        wndcls.hbrBackground    = (HBRUSH) (COLOR_3DFACE + 1); 
        wndcls.lpszMenuName     = NULL; 
        wndcls.lpszClassName    = DRAWPANEL_CLASSNAME; 
 
        if (!AfxRegisterClass(&wndcls)) 
        { 
            AfxThrowResourceException(); 
            return FALSE; 
        } 
    } 
 
    return TRUE; 
 
 
} 
 
BOOL CDrawPanel::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	 
	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); 
}