更改MFC中按钮的光标
我正在尝试更改 MFC 对话框中按钮的光标。我已经使用过
BOOL CStartDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if ( m_changeCursor )
{
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
return TRUE;
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
,但它正在改变整个对话框的光标。 m_button是CButton类的对象。 请告诉我如何更改按钮的光标。我也尝试过,但不起作用
m_button1.SetCursor(::LoadCursor(NULL, IDC_HAND));
I am trying to change cursor of a button in MFC dialog. i have used
BOOL CStartDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if ( m_changeCursor )
{
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
return TRUE;
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
but it is changing cursor for whole dialog box. m_button is object of CButton class.
Please tell me how to change cursor of a button.I have tryed this also but not working
m_button1.SetCursor(::LoadCursor(NULL, IDC_HAND));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调用 LoadCursor() 函数并将其返回值传递给 CMFCButton::SetMouseCursor() 成员函数。这是一个示例:
请参阅 http://www.functionx.com/visualc/ controls/mfcbtn.htm#subtitle
也可参考 Api CWinApp::LoadCursor
Call the LoadCursor() function and pass its returned value to the CMFCButton::SetMouseCursor() member function. Here is an example:
refer http://www.functionx.com/visualc/controls/mfcbtn.htm#subtitle
also refer Api CWinApp::LoadCursor