C# - 快速ListBox的数据更新 [英] c# - fast ListBox data update

查看:712
本文介绍了C# - 快速ListBox的数据更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在大约20行的一些文本数据显示。每一行可长于形式的大小。在这种情况下,该行的其余部分应被切掉。

I want to display in about 20 lines some text data. Every line can be longer than the size of the form is. In this case the rest of the line should be cut away.

我不希望有任何v键滚动条。

I don't want to have any h or v scroll bar.

由于ListBox控件可以与我的要求处理我试图使用它。一切工作正常,但如果我有一个沉重的磁盘负载,它可以发生,控制开始闪烁,我不觉得这是。我更新数据一次,第二次,我总是有不到20行文本数据。看来,我使用列表框错误的。

Since the ListBox control can deal with my requirements I tried to use it. Everything is working fine but if I have a heavy disk load it can happen that the control begins to flicker and I don't think this has to be. I am updating the data once a second and I always have less then 20 lines of text data. Seems that I'm using the ListBox wrong.

我有可能到prepare数据在其他线程作为一个字符串或字符串数​​组,但在任何情况下都更新整个列表框。哪种技术是最好的填充数据的列表框?我可以有两个缓冲区,我可以切换到与列表框使用呢?

I have the possibility to prepare the data in an other thread as a string or a string array but in every case have to update the whole ListBox. Which technique is the best for filling the ListBox with data? Can I have two buffers which I can toggle to be used with the ListBox?

希望有一个更好的解决办法...

Hope there is a better solution...

推荐答案

尝试调用的 SuspendLayout()为ListBox将数据添加到它之前,然后调用的 ResumeLayout()在列表框。您可能会丢失闪烁了一下。

Try calling SuspendLayout() for the ListBox before adding data to it and then call ResumeLayout() on the ListBox. You may lose that flicker a bit.

这篇关于C# - 快速ListBox的数据更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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