ScrollWindow 不滚动

mei想好xi 2020-05-30 07:38:16
编辑框,让它自动滚到最下面。关联一个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();

这样就不能滚动,只看到编辑框按钮在变。这个应该怎么用?
...全文
364 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
psbeond 2020-09-24
  • 打赏
  • 举报
回复
ScrollWindow应该不改变窗口的Scroll Info。它只是把DC上的内容滚动一下,然后把子窗口的坐标改变一下。
zgl7903 2020-06-19
  • 打赏
  • 举报
回复
发送 EM_LINESCROLL 消息


ruan1978 2020-06-19
  • 打赏
  • 举报
回复
建议跟踪调试下,看具体原因!
schlafenhamster 2020-06-01
  • 打赏
  • 举报
回复
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();
}
Simple-Soft 2020-05-30
  • 打赏
  • 举报
回复
后面这个操作的是窗体,前面那个操作的是编辑框,不一样

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧