我在单文档界面贴了两幅位图,我想要让鼠标放在位图上时光标变成手形,应该怎么弄呢?
BOOL CSYSTEMView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)这个里面应该怎么写,写点啥?
{
// TODO: Add your message handler code here and/or call default
return CView::OnSetCursor(pWnd, nHitTest, message);
}
------解决思路----------------------
你把位图声明为成员变量先:
BOOL CSetCursorOnViewView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
BOOL bHalt = CView::OnSetCursor(pWnd, nHitTest, message);
CPoint pt;
GetCursorPos(&pt);
ScreenToClient(&pt);
BITMAP bitinfo;
bitmap.GetBitmap(&bitinfo);
CRect rcBitmap(0, 0, bitinfo.bmWidth, bitinfo.bmHeight);
if(rcBitmap.PtInRect(pt))
{
AfxMessageBox("Mouse in bitmap!");
}
return bHalt;
}