改变光标的形状并获得其大小

 1     SetCursor(LoadCursor(NULL, IDC_CROSS)); //将光标变成十字型
 2     m_rePt = point;
 3     m_currentPt = point;
 4 
 5     HCURSOR hCursor = GetCursor();
 6     if (hCursor)
 7     {
 8         ICONINFO cursorInfo;
 9         GetIconInfo(hCursor, &cursorInfo);
10         CBitmap* pBmp = CBitmap::FromHandle(cursorInfo.hbmMask);
11         BITMAP bm;
12         if (pBmp != NULL && pBmp->GetBitmap(&bm))
13         {
14             int nHeight = bm.bmHeight;
15             int nWidth = bm.bmWidth;
16 
17             m_rePt.x -= bm.bmWidth / 2;
18             m_rePt.y -= bm.bmHeight / 4;
19             m_currentPt.x -= bm.bmWidth / 2;
20             m_currentPt.y -= bm.bmHeight / 4;
21         }
22     }

 

posted @ 2016-12-29 16:58  风的哀伤  阅读(350)  评论(0编辑  收藏  举报