看到过“用鼠标去点你想找的那一点,在WM_LBUTTONDOWN的响应函数读到的坐标点就是应该对应该像素点的图像坐标”,刚开始学VC++,具体应该怎么做,谢谢。

解决方案 »

  1.   

    void CMyButton::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    // TODO: Add your message handler code here and/or call default

        CButton::OnLButtonDown(nFlags, point);
        CPoint   pt;   
        GetCursorPos(&pt);   
        CString   str,str1;   
        str1.Format("%ld",pt.x);   
        MessageBox(str1);   
        str.Format("%ld",pt.y);   
        MessageBox(str);
    }这样在窗口中点击鼠标,并没有看到坐标值?
      

  2.   

    CPoint   pt;   
        GetCursorPos(&pt);   
        CString   str,str1;   
        str1.Format("%ld",pt.x);   
        MessageBox(str1);   
        str.Format("%ld",pt.y);   
        MessageBox(str);
    放在CButton::OnLButtonDown(nFlags, point);
    之前。