能说具体点吗? 我发现在我setcursor之后,只要mousemove程序会还原原来的光标,所以我把 setcursor放在了mousemove事件里 我查了一下MSDN,他的解释是 make sure the class cursor for the specified window's class is set to NULL. If the class cursor is not NULL, the system restores the class cursor each time the mouse is moved. 可见他一直在恢复原来的光标,那么我怎样改变初始光标为NULL呢?
CYourView::SomeLongTimeOperation()
{
CWaitCursor wait;
...... // 从这里开始到该函数结束,沙漏光标一直显示
}如果,要跨函数,只能调用API了:
设置处:
hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
//保存好hCursor,可以是全局量
设置回来:
SetCursor(hCursor);
SetCursor(LoadCursor(NULL, IDC_YOURICON));
一般的做法是,在OnSetCursor中先做一个HitTest,然后根据光标的位置,设置成合适的形状。
我发现在我setcursor之后,只要mousemove程序会还原原来的光标,所以我把
setcursor放在了mousemove事件里
我查了一下MSDN,他的解释是
make sure the class cursor for the specified window's class is set to NULL. If the class cursor is not NULL, the system restores the class cursor each time the mouse is moved.
可见他一直在恢复原来的光标,那么我怎样改变初始光标为NULL呢?
在OnSetCursor()中你用SetCursor()设置光标
return 之前
添加
cs.lpszClass=AfxRegisterWndClass(CS_HREDRAW,AfxGetApp()->LoadStandardCursor(IDC_UPARROW),
::CreateSolidBrush(RGB(255,122,0))); 看看什么效果