veduongtron
/* Ve duong tron khi click chuot trai */
#include<afxwin.h>
class CMyApp:public CWinApp
{
public:
BOOL InitInstance();
};
CMyApp theApp;
//khai bao lop cua so
class CMyWin:public CFrameWnd
{
public:
CMyWin();
DECLARE_MESSAGE_MAP();
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
};
//xay dung ham tao cua lop cua so
CMyWin::CMyWin()
{
//tao ra cua so
Create(NULL,"Pham Phuong Tu");
}
//xay dung ham khoi tao ung dung
BOOL CMyApp::InitInstance()
{
m_pMainWnd=new CMyWin();//tao ra 1 cua so
m_pMainWnd->ShowWindow(2);//dat che do hien thi
m_pMainWnd->UpdateWindow();//ve cua so ra
return TRUE;
}
BEGIN_MESSAGE_MAP(CMyWin,CFrameWnd)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
afx_msg void CMyWin::OnLButtonDown( UINT nFlags, CPoint point )
{
CDC *dc=GetDC();
PAINTSTRUCT ps;
dc->Ellipse( ( (point.x)-50), ((point.y)-50), ((point.x)+50), ((point.y)+50));
//dc->LineTo(point.x,point.y);
EndPaint(&ps);
}
Bạn đang đọc truyện trên: Truyen247.Pro