建立了一个基于对话框的MFC应用程序,在主对话框中有一个编辑框,用于显示接收到的数据,现在我有一个问题,怎样才能使接收到的数据往上滚动,而最新的数据在编辑框的最下面,让我可以看到最新的数据?

解决方案 »

  1.   

    CEdit::LineScroll 
    void LineScroll( int nLines, int nChars = 0 );ParametersnLinesSpecifies the number of lines to scroll vertically.nCharsSpecifies the number of character positions to scroll horizontally. This value is ignored if the edit control has either the ES_RIGHT or ES_CENTER style.ResCall this function to scroll the text of a multiple-line edit control. This member function is processed only by multiple-line edit controls. The edit control does not scroll vertically past the last line of text in the edit control. If the current line plus the number of lines specified by nLines exceeds the total number of lines in the edit control, the value is adjusted so that the last line of the edit control is scrolled to the top of the edit-control window. LineScroll can be used to scroll horizontally past the last character of any line.For more information, seeEM_LINESCROLL in the Win32 documentation.See the example for CEdit::GetFirstVisibleLine.
    =========================================================================
    相关
    CEdit::GetLineCount 
    int GetLineCount( ) const;Return ValueAn integer containing the number of lines in the multiple-line edit control. If no text has been entered into the edit control, the return value is 1.ResCall this function to retrieve the number of lines in a multiple-line edit control. GetLineCount is only processed by multiple-line edit controls.For more information, seeEM_GETLINECOUNT in the Win32 documentation.
      

  2.   

    一句话就能搞定的事情居然给出这么多文字。 m_edtState.LineScroll(6500);