您的位置:首页 > 其它

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

2014-04-08 18:07 453 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐