用SetCursor为什么不能改变光标?

BOOL CDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)  
{
// TODO: Add your message handler code here and/or call default
if(m_hcursor)
{
HCURSOR hOld = ::SetCursor(m_hcursor);
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}

 

原因:

直接return TRUE,表示光标已经设置
不要return CDialog::OnSetCursor(pWnd, nHitTest, message);
否则光标会被CDialog::OnSetCursor()再设回去编程默认的。

 

posted @ 2015-06-07 19:54  kelseyling  阅读(1372)  评论(0编辑  收藏  举报