CListCtrl控件更新数据自动滚动到第一列,水平滚动条无效

xumaojun 2009-07-20 05:53:17
我在CListCtrl(report风格)控件中展示一些数据,每5秒更新一次,现在拖动水平滚动条到最后一列,更新时自动滚动到第一列。不过windows任务管理器就不会自动滚动到第一列。这个怎么实现啊,要在什么地方设置吗?
...全文
262 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xumaojun 2009-07-21
  • 打赏
  • 举报
回复
终于找到答案了,谢谢各位帮助。
1.首先记下滚动条位置
SIZE sz;
sz.cx = GetScrollPos( SB_HORZ );
sz.cy = GetScrollPos( SB_VERT );
2.更新数据 ……
3.恢复滚动条位置
CSize szPointB(sz);
ctlList.Scroll(sz);
  • 打赏
  • 举报
回复
CListCtrl::Scroll
BOOL Scroll( CSize size );

Return Value

Nonzero if successful; otherwise zero.

Parameters

size

A CSize object specifying the amount of horizontal and vertical scrolling, in pixels. The y member of size is divided by the height, in pixels, of the list view control’s line, and the control is scrolled by the resulting number of lines.

xumaojun 2009-07-20
  • 打赏
  • 举报
回复
Scroll的参数传个什么值啊,在什么时候调用这个函数呢?
wu_qing_yun 2009-07-20
  • 打赏
  • 举报
回复
楼上正解
阜哥 2009-07-20
  • 打赏
  • 举报
回复
试试CListCtrl::Scroll()函数

15,979

社区成员

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

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