为什么设置光标总不起作用?
我用CStatic作了一个CHyperlinkStatic类,想把它作为超链接用,所以在鼠标移过的时候想把鼠标光标设为手型,可是不知道为什么不行?
void CHyperlinkStatic::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CRect rect;
GetClientRect(&rect);
//ClientToScreen(&rect);
CFont *pFont = GetFont();
LOGFONT LogFont;
pFont->GetLogFont(&LogFont);
if(rect.PtInRect(point))
{
LogFont.lfUnderline = TRUE;
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_HAND)); //IDC_CURSOR_HAND是我自建的一个鼠标光标
SetCapture();
}
else
{
LogFont.lfUnderline = FALSE;
ReleaseCapture();
}
pFont->CreateFontIndirect(&LogFont);
SetFont(pFont,TRUE);
CStatic::OnMouseMove(nFlags, point);
}