{
...
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(MyFrame, CFrameWnd)
...
END_MESSAGE_MAP()
ON_WM_LBUTTONDOWN() : 滑鼠左鍵按下
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
{
char szBuffer[100];
wsprintf(szBuffer, "LButton point(%ld, %ld)", point.x, point.y);
MessageBox(szBuffer);
}
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
{
SetCapture();
}
ON_WM_MOUSEMOVE() : 滑鼠游標移動
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
{
if ( this == GetCapture() )
{
CClientDC aDC(this);
aDC.SetPixel(point, RGB(225, 0, 0) );
}
}
ON_WM_LBUTTONUP() : 滑鼠左鍵放開
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
{
ReleaseCapture();
}
沒有留言:
張貼留言