如何制作滚动listctrl? [英] How to make a scrolling listctrl ?

查看:86
本文介绍了如何制作滚动listctrl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1。我想制作一个滚动的listctrl,所以不要使用下一个屏幕按钮或上一个屏幕按钮。



2.在listctrl屏幕中,例如:

- 如果要显示10行

- 在程序中,我将值移动到listCtrl变量(insertItem,setItemText)

- 之后将值移动到所有10行,屏幕显示使用UpdateData(FALSE)

- 因此,有一个不确定的时间间隔来显示数据。

- 问题:如何在不使用10行的一次显示的情况下向屏幕显示每条记录。



谢谢



我尝试了什么:



我浪费了1个月来解决上述问题。上帝保佑我!

1. I want to make a scrolling listctrl, so do not use next-screen button or previous-screen button.

2. In the listctrl screen, for example:
- If there are 10 rows to display
- In the program, I move the values to the listCtrl variables (insertItem, setItemText)
- After moving the values to all 10 rows, the screen display at using "UpdateData(FALSE)"
- So, there is a somehow time interval to display data.
- Question: How can I show the each record to the screen not using one time display of 10 rows.

Thank you

What I have tried:

I wasted 1 month to solve the above problem. God bless me!

推荐答案

目前还不太清楚你在寻找什么,但我会尽力回答。



如果您想更快地更新列表项,可以在插入和更改项目时禁用重绘:

It is not quite clear what you are looking for but I will try to answer.

If you want to make updating the list items faster, you can disable redrawing while inserting and changing items:
// Disable redrawing while updating the list
SetRedraw(FALSE);
// Add or update items here
SetRedraw(TRUE);





A CListCtrl 默认启用滚动功能。除了用户与滚动条和箭头/页面键的交互,您还可以使用 CListCtrl :: Scroll [ ^ ]。请注意,这需要像素值,但仅垂直滚动整行。所以你必须传递行数乘以行高。



如果你只想确保特定行可见,你可以使用CListCtrl::EnsureVisible [ ^ ]。



A CListCtrl has scrolling enabled by default. Besides user interaction with the scroll bars and arrow / page keys you can also scroll programmatically using CListCtrl::Scroll[^]. Note that this expects pixel values but scrolls vertically only by full lines. So you have to pass the number of lines multiplied by the line height.

If you only want to ensure that a specific row is visible you can use CListCtrl::EnsureVisible[^].


这篇关于如何制作滚动listctrl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆