改变光标形状

1.重载OnSetCursor

 

HCURSOR hcursor;

 

BOOL CT_20Dlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
 // TODO: Add your message handler code here and/or call default
    SetCursor(hcursor);
    return true;
 return CDialog::OnSetCursor(pWnd, nHitTest, message);
}

 

2.设置光标

void CT_20Dlg::OnLButtonUp(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default
 hcursor=AfxGetApp()->LoadCursor(IDC_CURSOR2);       //加载自定义光标
 this->OnSetCursor(this, HTNOWHERE,WM_SETCURSOR); 
 CDialog::OnLButtonUp(nFlags, point);
}

void CT_20Dlg::OnLButtonDown(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default
  hcursor=AfxGetApp()->LoadCursor(IDC_CURSOR1);       //加载自定义光标
 this->OnSetCursor(this, HTNOWHERE,WM_SETCURSOR); 
 CDialog::OnLButtonDown(nFlags, point);
}

你可能感兴趣的:(改变光标形状)