[英]Not able to set Hand cursor when the mouse cursor is over a button in my MFC application
I created a new custom button class (derived from CButton). 我创建了一个新的自定义按钮类(从CButton派生)。 Overrode the OnMouseMove API in the new custom class. 在新的自定义类中覆盖OnMouseMove API。 When my mouse cursor moves over the button in a dialog, the OnMouseMove API in the custom button class is called successfully but the cursor symbol is not changed to Hand symbol :( 当我的鼠标光标移到对话框中的按钮上时,将成功调用自定义按钮类中的OnMouseMove API,但光标符号不会更改为Hand symbol :(
In the OnMouseMove() API I have the following code: 在OnMouseMove()API中,我具有以下代码:
if (m_hClickCursor == NULL)
m_hClickCursor = AfxGetApp()->LoadCursor(IDC_CLICK_CURSOR);
if (m_hClickCursor)
this->SetCursor(m_hClickCursor);
Here, 这里,
IDC_CLICK_CURSOR is a reference to hand cursor (I use the same hand cursor at other places in my app). IDC_CLICK_CURSOR是对手形光标的引用(我在应用程序的其他位置使用相同的手形光标)。
m_hClickCursor is the handle to the cursor m_hClickCursor是光标的句柄
Please Help !! 请帮忙 !!
Thanks, -Nayan 谢谢,-Nayan
您必须处理WM_SETCURSOR才能执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.