在状态栏的窗格里怎样输出鼠标的坐标?请帮一下

解决方案 »

  1.   

    在鼠标移动事件中,调用:
    CStatusBar* pStatus = (CStatusBar*)
    AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR);
    pStatus->SetPaneText(1,sLat+"  "+sLong);
      

  2.   

    // CTestView 消息处理程序
    void CTestView::OnMouseMove(UINT nFlags, CPoint point)
    {
    CMainFrame *pWnd=(CMainFrame*)AfxGetMainWnd();
    pWnd->m_wndStatusBar.SetPaneInfo(2,ID_SEPARATOR,SBPS_NORMAL,150);
    CString StrInfo;
    StrInfo.Format("鼠标当前位置:X=%002d:Y=%002d",point.x,point.y);
        pWnd->m_wndStatusBar.SetPaneText(2,StrInfo);
    CView::OnMouseMove(nFlags, point);
    }