MFC显示鼠标位置

    科技2022-07-15  131

    主要是OnMove()函数:

    eg:

     

    void CGDI_testView::OnMouseMove(UINT nFlags, CPoint point){     // TODO: 在此添加消息处理程序代码和/或调用默认值    int x=point.x;    int y=point.y;    CString str;    str.Format(_T("[%d,%d]   "),x,y);    CDC *pDC=GetDC();    pDC->TextOut(0,0,str);    ReleaseDC (pDC);    CView::OnMouseMove(nFlags, point);}

     

    注意,str.Format(_T("[%d,%d]   "),x,y);中引号中空格是消除重叠现象。

    Processed: 0.008, SQL: 8