方法一:响应鼠标右键消息 WM_RBUTTONDOWN()
添加代码: CString str;
str.Format("坐标:X=%d,Y=%d",point.x,point.y );
添加代码: CString str;
str.Format("坐标:X=%d,Y=%d",point.x,point.y );
AfxMessageBox(str); 右击鼠标即出现坐标。
方法二:在onmousemove消息相应函数中(响应消息WM_MOUSEMOVE)
添加以下代码:int x=point.x;
int y=point.y;
CString str;
str.Format(("%d,%d"),x,y);
CDC *pDC=GetDC();
pDC->TextOut(0,0,str);
ReleaseDC (pDC); 鼠标所在之处即是坐标。