void CRSView::OnMouseMove(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
              if(mousepress==true)
{
rect.top=rect.top+(mouseX-point.x);
         rect.left=rect.left+(mouseY-point.y);
}
  CWnd ::OnMouseMove(nFlags, point);
}void CRSView::OnLButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default 
mousepress=true;
mouseX=point.x;
mouseY=point.y;
     CWnd ::OnLButtonDown(nFlags, point);
}
其中rect是在OnPaint()函数里画的矩形,我本意是这样的,利用OnMouseMove来拖动画的矩形,但实现不了,在OnLButtonDown中Flags=1,但在OnMouseMove中Flags=0,为什么啊??哪里错啦 各位大虾帮帮啦???

解决方案 »

  1.   

    nFlags
    Indicates 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.0表示上面的这些键都没有被按下
      

  2.   

    Flags还是mousepress?LZ,貌似你关心的是mousepress这个变量.