在C#慢树状 [英] Slow treeview in C#

查看:108
本文介绍了在C#慢树状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C#编写的遗留应用程序,它显示10 20万余元一个非常复杂的树状视图。

I have a legacy application that is written in C# and it displays a very complex treeview with 10 to 20 thousand elements.

在过去我遇到类似的问题(但在C ++),我解决了由Win32 API提供的OWNERDATA能力。

In the past I encountered a similar problem (but in C++) that i solved with the OWNERDATA capability offered by the Win32 API.

有没有在C#中类似的机制?

Is there a similar mechanism in C#?

编辑:我们的计划是优化创建时间以及浏览的时间。可通过Win32 API的方法是优异的这两种情况下,因为它降低初始化时间无关和元件请求的数目被限制为仅在那些在任何一个时间显示。
Joshl:实际上,我们做的正是你有什么建议了,但我们仍然需要更多的效益。

The plan is to optimize the creation time as well as browsing time. The method available through Win32 API is excellent in both of these cases as it reduce initialization time to nothing and the number of requests for elements are limited to only the ones visible at any one time. Joshl: We are actually doing exactly what you suggest already, but we still need more efficiency.

推荐答案

我不不敢相信的.NET TreeView的支持你想要什么,虽然这种类型的模型是由.NET的DataGridView中(参见DataGridView中的的 VirtualMode 属性)。在TreeView将让您绘制自己的节点,但它不会让你从一些虚拟商店填充它们。

I don't believe the .NET TreeView supports what you want, although this type of model is supported by .NET's DataGridView (see DataGridView's VirtualMode property). The TreeView will let you draw your own nodes but it won't let you populate them from some virtual store.

如果可能的话,你可能要考虑使用的DataGridView中为您的应用。如果不是,手动管理节点(如上面joshl提到的)可能,如果你能解决一些问题,正确地刷新屏幕,当节点展开工作。以外的是,你可能要检查出一些第三方厂商,像这样 之一,可能(强调力量)支持你想要的操作模式。

If possible, you might want to consider the use of a DataGridView for your application. If not, managing the nodes manually (like joshl mentions above) might work if you can get around some issues with refreshing the screen properly when nodes are expanded. Outside of that, you might want to check out some of the third party vendors, like this one, that might (emphasis on might) support your desired mode of operation.

这篇关于在C#慢树状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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