将鼠标移动到Button1上时的图标变成手形状的方法
来源:岁月联盟
时间:2009-02-24
Step1:
在cpp顶部添加下面代码:
#undef WINVER
#define WINVER 0x500
#if(WINVER >= 0x0500)
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
Step2:
重载消息OnSetCursor
BOOL CTestDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
...{
// TODO: Add your message handler code here and/or call default
switch(pWnd->GetDlgCtrlID())
...{
case IDC_BUTTON1:
SetCursor(::LoadCursor(NULL, IDC_HAND));
break;
default :
SetCursor(::LoadCursor(NULL, IDC_ARROW));
}
return TRUE;
//return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
上一篇:计算机老师眼中的C语言学习
下一篇:C语言中基本的排序算法