字符串列表排序进度条 [英] Stringlist sort progress bar

查看:86
本文介绍了字符串列表排序进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TListBox,加载时可以有一个很长的字符串列表,因此我可以让操作员通过单击按钮来启动Sort.有时,排序可能要花一分钟左右的时间,而操作员却想知道正在发生什么.

I have a TListBox that can have a very long stringlist when loaded so I have the operator initiate a Sort by clicking a button. Sometimes the sort can take close to a minute and the operator is left wondering what's happening.

有什么方法可以使用TProgressBar来显示正在发生的事情吗?如果可以,怎么办?

Is there any way I can use a TProgressBar to show that something is happening? If so, how?

OR

我可以在开始时将屏幕显示为灰色(在视觉上处于禁用状态),然后在排序完成后重新变回白色吗?如果可以,怎么办?

Can I Grey (visually disabled) the screen at the start and then color back to white when the sort is completed? If so, how?

谢谢

推荐答案

我相信您的根本问题是,您正在使用可视控件作为容器.对容器内的列表进行排序会产生糟糕的性能.将60,000个字符串放入TStringList中,您就可以立即对其进行排序.

I believe that your fundamental problem is that you are using a visual control as a container. Sorting the list inside the container will have terrible performance. Put 60,000 strings in a TStringList and you'll be able to sort them instantly.

您可以在虚拟模式下操作它,而不是将其保留在视觉控件中.这将是最有效的操作方式.

Rather than holding the items in the visual control, you can operate it in virtual mode. That will be the most efficient way to operate.

如果进行这些更改,则不需要进度栏.

If you make these changes then you won't need a progress bar.

这篇关于字符串列表排序进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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