Edit Box多行显示时如何使滚动条始终在下方

两种方法:

①  CEdit *pEdit = ((CEdit*)GetDlgItem(IDC_EDIT_RXDATA));

    pEdit->LineScroll(pEdit->GetLineCount()); //滚动条滚动到最下端

    int tmpLen  = pEdit->GetWindowTextLength();

    pEdit->SetSel(tmpLen,-1,true); //定位光标到内容末尾

这种方法会出现闪屏!

②  int nLen=m_ctlRXData.GetWindowTextLength();

    m_ctlRXData.SetSel(nLen, nLen);

    m_ctlRXData.ReplaceSel(strtemp);

其中m_ctlRXData是控件变量,strtemp是要显示的内容。不出现闪屏。

原文地址:https://www.cnblogs.com/keanuyaoo/p/3265235.html