#include <Afxwin.h>
class CMyApp:public CWinApp
{
BOOL InitInstance();
};
class CMyWindow:public CFrameWnd
{
// public:
// CMyWindow();
// ~CMyWindow();
//afx_msg void OnPaint();
public:
void OnPaint();
afx_msg void OnNcPaint( );
DECLARE_MESSAGE_MAP();
};
#include "hello.h"
CMyApp theApp;
BEGIN_MESSAGE_MAP(CMyWindow,CFrameWnd)
ON_WM_PAINT()
ON_WM_NCPAINT()
END_MESSAGE_MAP()
CMyApp::InitInstance()
{
CMyWindow *MainWnd = new CMyWindow;
MainWnd->Create(NULL,"llsls");
m_pMainWnd = MainWnd;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
// ::MessageBox(0,"Hello","Simple MFC",MB_OK);
return true;
}
void CMyWindow::OnPaint()
{
CClientDC pDC(this);
CRect rc;
GetClientRect(&rc);
PAINTSTRUCT ps;
//BeginPaint(&ps);
//pDC.SetBkColor(TRANSPARENT);
//pDC.Rectangle(CRect(0, 0, 100, 100));
pDC.DrawText(_T("hello,world"),&rc,DT_SINGLELINE | DT_CENTER | DT_VCENTER );
// EndPaint(&ps);
// ReleaseDC(pDC);
CFrameWnd::OnPaint();
}
void CMyWindow::OnNcPaint()
{
// CDC *pDC = GetWindowDC();
// CRect rc;
// // GetClientRect(&rc);
// pDC->Rectangle(CRect(0, 0, 100, 100));
// ReleaseDC(pDC);
//dc.DrawText(_T("hello,world"),&rc,DT_SINGLELINE | DT_CENTER | DT_VCENTER );
}
// CMyWindow::CMyWindow()
// {
//
//
// }