OnSetCursor由消息 WM_SETCURSOR 触发 The WM_SETCURSOR message is sent to a window if the mouse causes th

来源:互联网 发布:淘宝怎么购买qq号 编辑:程序博客网 时间:2024/05/16 17:29

 OnSetCursor由消息 WM_SETCURSOR 触发 

The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured.

看清楚了,只要鼠标移动OnMouseMOve就会自动发送 WM_SETCURSOR从而触发OnSetCursor,因此在设计改变鼠标指针的程序时,一般不要在OnMouseMOve事件中调用SetCursor,容易引起指针闪烁。设置鼠标指针形状合理的方法是:
在OnMouseMove中使用一个变量记住各矩形crect中的鼠标形状,然后在OnSetCursor调用SetCursor设置鼠标

m_hCursor = LoadCursor(NULL,IDC_IBEAM);
SetCursor(m_hCursor);

………………

BOOL COpenGL_testView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
SetCursor(m_hCursor); 
return TRUE;
}

OK!问题解决。

The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured.

看清楚了,只要鼠标移动OnMouseMOve就会自动发送 WM_SETCURSOR从而触发OnSetCursor,因此在设计改变鼠标指针的程序时,一般不要在OnMouseMOve事件中调用SetCursor,容易引起指针闪烁。设置鼠标指针形状合理的方法是:
在OnMouseMove中使用一个变量记住各矩形crect中的鼠标形状,然后在OnSetCursor调用SetCursor设置鼠标

m_hCursor = LoadCursor(NULL,IDC_IBEAM);
SetCursor(m_hCursor);

………………

BOOL COpenGL_testView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
SetCursor(m_hCursor); 
return TRUE;
}

OK!问题解决。


http://5902977.blog.51cto.com/5892977/1016307

0 0
原创粉丝点击