当鼠标在某行时,在状态栏中显示编辑框中的行号和列号 

解决方案 »

  1.   

    每次edit框的selectchange都要重新设置状态栏!
      

  2.   

    添加个消息响应函数OnMouseMove(UINT nFlags, CPoint point)
    然后将point的值进行一下格式化
    CString m_str = "";
    m_str.Format("x=%d,y=%d",point.x,point.y);
      

  3.   

    1>.在串表中加:
    static UINT indicators[] =
    {
    ID_SEPARATOR,           // status line indicator
    ID_INDICATOR_LINE,
    ID_INDICATOR_COLUMN,
    ID_SEPARATOR,           //
    ID_INDICATOR_SCRL,
    };
    2>.初始化时:
    m_wndStatusBar.SetPaneText(0,"Can You See Status Bar?");
    UINT nID;
    UINT nStyle;
    int  cxWidth;
    m_wndStatusBar.GetPaneInfo(1, nID, nStyle, cxWidth );
    cxWidth+=15;
    m_wndStatusBar.SetPaneInfo(1, nID, nStyle, cxWidth ); 
    //每当行列变化时:
    m_wndStatusBar.SetPaneText(1,"L= 100");
    m_wndStatusBar.SetPaneText(2,"C= 100");
      

  4.   

    重写CEdit类,处理WM_LBUTTONDOWN消息,类似这样:void CNewEdit::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    // TODO: Add your message handler code here and/or call default

    CEdit::OnLButtonDown(nFlags, point); int n = CharFromPos(point);
    int nLineIndex = HIWORD(n);
    int nCharIndex = LOWORD(n);
    int nColIndex = nCharIndex - LineIndex(-1);
    CString str;
    str.Format(_T("Line: %d, Col: %d"), nLineIndex, nColIndex);
    AfxMessageBox(str);
    }
      

  5.   

    把点击的行数取出放入状态栏不就行了,那些都有对应的api的
      

  6.   

    啥也别想,先定义两全局变量X,Y表示位置剩下的问题就简单了,一分为二1,如何得到行列数保存到X,Y里
    2,如何在状态栏显示X,Y这下各是各的,问题简单化了吧?