cau1de2
#include<afxwin.h>
class CMyApp : public CWinApp
{
public:
BOOL InitInstance();
};
class CMyWin : public CFrameWnd
{
public:
CMyWin();
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};
CMyApp theApp;
BOOL CMyApp::InitInstance()
{
m_pMainWnd=new CMyWin;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return true;
}
BEGIN_MESSAGE_MAP(CMyWin,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
CMyWin::CMyWin()
{
Create(NULL,"Nguyen Dai Duong - 08B1");
}
afx_msg void CMyWin::OnPaint()
{
RECT r;
CDC *dc=GetDC();
PAINTSTRUCT ps;
int xt,yt,h,w, a, b;
a=r.bottom-r.top;
b=r.right-r.left;
xt=b/2;yt=a/2;
dc->Rectangle(-1, -1, b+1, a+1);
GetClientRect(&r);
h=r.bottom-r.top;
w=r.right-r.left;
xt=w/2;yt=h/2;
BeginPaint(&ps);
dc->Rectangle(xt-h/3,yt-h/3,xt+h/3,yt+h/3);
EndPaint(&ps);
}
Bạn đang đọc truyện trên: Truyen247.Pro