我在ONMOUSEMOVE中设置光标,可以达到效果
我想让鼠标左键按下时,更换光标,但是在onLButtonDown中,用::SetCursor()设置光标,debug时可以看到执行了此语句,但运行时发现光标在按下左键时却没有变化,哪位高手能指点一下,不胜感激!

解决方案 »

  1.   

    你应该设置一个变量标志当前应该显示什么样的光标,然后在响应WM_SETCURSOR 消息,在CWnd::OnSetCursor 函数中加类似代码:
    if (NULL  !=  m_hCursor)
    {
      ::SetCursor(m_hCursor);
      return true;
    }
      

  2.   

    1.void CXXView::OnMouseMove(UINT nFlags, CPoint point) 
    {
             HCURSOR m_hCursor=AfxGetApp()->LoadCursor(IDC_CURSOR2);
    ::SetCursor(m_hCursor);
    CView::OnMouseMove(nFlags, point);
    }
    2.void CXXView::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    HCURSOR m_hCursor=AfxGetApp()->LoadCursor(IDC_CURSOR1);
    ::SetCursor(m_hCursor);
    CView::OnLButtonDown(nFlags, point);
    }
    3.BOOL CXXView::PreCreateWindow(CREATESTRUCT& cs)
    {
      
    cs.lpszClass=AfxRegisterWndClass(
    CS_HREDRAW|CS_VREDRAW
    ,0
          ,(HBRUSH)::GetStockObject(0)
      ,0);
    return CView::PreCreateWindow(cs);
    }