MFC里mousemove函数如下
void CGobangView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
int x = point.x;
int y = point.y;
CString st;
st.Format(("%d,%d"), point.x, point.y);
CDC *pDC = GetDC();
pDC->TextOut(20, 20, st);
ReleaseDC(pDC);
SetCursor(LoadCursor(NULL, IDC_CROSS)); CView::OnMouseMove(nFlags, point);
}但是显示的时候左上角y的坐标会很大,明显不对啊,哪里出问题了。。求指导
void CGobangView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
int x = point.x;
int y = point.y;
CString st;
st.Format(("%d,%d"), point.x, point.y);
CDC *pDC = GetDC();
pDC->TextOut(20, 20, st);
ReleaseDC(pDC);
SetCursor(LoadCursor(NULL, IDC_CROSS)); CView::OnMouseMove(nFlags, point);
}但是显示的时候左上角y的坐标会很大,明显不对啊,哪里出问题了。。求指导
{
CString str;
str.Format(_T("x=%d,y=%d"),point.x,point.y);
SetWindowText(str); CDialog::OnMouseMove(nFlags, point);
}
覆盖显示的可能性很大,充分拉开显示距离或显示之前刷背景
UINT nFlags,
CPoint point
);
point
Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.