MFC 有事需要鼠标点击的像素位置

来源:互联网 发布:女生问你喜欢我吗 知乎 编辑:程序博客网 时间:2024/05/14 12:09

用messagebox  cstring.format太麻烦

BOOL GetCursorPos(
  LPPOINT lpPoint   // address of structure for cursor position
);


在对话框中放一静态文本, IDC_STATIC1

void CtestDlg::OnMouseMove(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
CString str;
    str.Format("%d,%d",point.x,point.y);
    GetDlgItem(IDC_STATIC1)->SetWindowText(str);


CtestDlg::OnMouseMove(nFlags, point);
}

这样就不会疯了!

0 0
原创粉丝点击