編輯框,讓它自動滾到最下面。關聯一個CEdit物件,用LineScroll這樣就可以滾動
m_edit.SetWindowText(m_LogString);
m_edit.LineScroll(m_edit.GetLineCount());
換一種方法:
UpdateData(FALSE);
int minPos, maxPos, curPos;
GetDlgItem(IDC_EDIT1)->GetScrollRange(SB_VERT, &minPos, &maxPos);
curPos = GetDlgItem(IDC_EDIT1)->GetScrollPos(SB_VERT);
GetDlgItem(IDC_EDIT1)->SetScrollPos(SB_VERT, maxPos);
GetDlgItem(IDC_EDIT1)->ScrollWindow(0, curPos - maxPos);
GetDlgItem(IDC_EDIT1)->UpdateWindow();
這樣就不能滾動,只看到編輯框按鈕在變。這個應該怎么用?
uj5u.com熱心網友回復:
后面這個操作的是表單,前面那個操作的是編輯框,不一樣uj5u.com熱心網友回復:
ScrollWindow 是 edit 的 父類 函式, 并不 合適 edit試試:
void CDrawEditDlg::OnButton2()
{//
// TODO: Add your control notification handler code here
int lineHeight=20;// device unit
GetDlgItem(IDC_EDIT1)->ScrollWindow(0, -lineHeight);
// redraw dialog !
Invalidate();
UpdateWindow();
}
uj5u.com熱心網友回復:
建議跟蹤除錯下,看具體原因!uj5u.com熱心網友回復:
發送 EM_LINESCROLL 訊息轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/11991.html
標籤:界面
