响应OnMouseMoveCWnd::OnMouseMove afx_msg void OnMouseMove( UINT nFlags, CPoint point );ParametersnFlagsIndicates whether various virtual keys are down. This parameter can be any combination of the following values: MK_CONTROL Set if the CTRL key is down. MK_LBUTTON Set if the left mouse button is down. MK_MBUTTON Set if the middle mouse button is down. MK_RBUTTON Set if the right mouse button is down. MK_SHIFT Set if the SHIFT key is down. ======================================== 看到了吧,然后判断nFlags中是否包含MK_LBUTTON属性在里面。
OnLButtonDown和OnLButtonUp
afx_msg void OnMouseMove( UINT nFlags, CPoint point );ParametersnFlagsIndicates whether various virtual keys are down. This parameter can be any combination of the following values: MK_CONTROL Set if the CTRL key is down.
MK_LBUTTON Set if the left mouse button is down.
MK_MBUTTON Set if the middle mouse button is down.
MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.
========================================
看到了吧,然后判断nFlags中是否包含MK_LBUTTON属性在里面。
{
// TODO: Add your message handler code here and/or call default
SetCapture();
m_mousePoint = point;
::SetCursor(AfxGetApp()->LoadCursor (IDC_CURSOR_HAND));
CDialog ::OnLButtonDown(nFlags, point);
}void CMyDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
ReleaseCapture();
CDialog ::OnLButtonUp(nFlags, point);
}void CMyDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (MK_LBUTTON == nFlags)
{
//mouse move && LButtonDown
}
CDialog ::OnMouseMove(nFlags, point);
}