自定义可扩展ListView [英] Custom Expandable ListView

查看:124
本文介绍了自定义可扩展ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题与.NET 4.0提供的WinForms ListView控件/类有关

我的目标是能够添加一个make listview控件,该控件能够展开/折叠其项目,并且一旦展开,将显示一个可以在其中包含任何控件的容器面板.

我知道我必须在此上使用所有者绘图,并且在站点上已经有很多将TreeView与ListView混合使用的示例,但是它们都不适合我的需求,因此这就是我打开此帖子的主要原因.

我希望了解有关此方法的一些指导原则,到目前为止,我已经从ListViewItem继承了一个允许我的项目具有展开/折叠属性和绘制容器面板的方法,但是我仍然停留在ListView控件部分,例如,一旦展开一项以腾出空间来绘制containercontrol,就没有找到在列表视图上向下移动元素的方法.

有什么方法可以覆盖绘画并更改每个项目的绘制边界?

我正在使用VB.net,但我也毫不费力地翻译C#代码...
在这方面的任何帮助将不胜感激.

This question is regarding WinForms ListView control/classes provided by .NET 4.0

My goal is the be able to add a make a listview control that is capable to expand/collapse its item, and once expanded show a containerpanel that can have any controls in in.

I know that i have to use owner draw on this, and that there is a lot of example of mixing the TreeView with a ListView already on the site but none of them suites my needs so thats the main reason I''m opening this post.

I would appreciate some guidelines on this approach, so far I already inherited a from ListViewItem to allow my items to have a expanded/collapsed property and the containerpanel to be draw, but im stuck on the ListView control part, as, for instance, i didn''t found a way to "shift" elements down on the listview once a item is expanded to make space to draw the containercontrol.

Is there any way to override the paint and change the bounds on which each item is drawn?

Im using VB.net but i have no troubles translating C# code as well...
Any help on this would be really appreciated.

推荐答案

感谢您对问题的遵从和澄清(我投票赞成).最好自行修改问题,并在评论中留下通知.为了自己的利益,还应该标记UI库.请参阅我对这个问题的最后评论.

有一些商业产品提供类似的东西.让我们把它们放在一边;如果需要,您可以找到它们.

我在此字段中看到的最接近也是最有趣的代码是此CodeProject文章:虚拟模式TreeListView [ ^ ].

在此代码中使用虚拟模式甚至更有价值.它还可以让您处理海量数据,因为它们没有存储在控件中.

另外(以防万一),请查看此CodeProject文章:可折叠的ListViewGroup [ ^ ].

祝你好运,
—SA
Thank you for compliance and clarification of the question (I up-voted it). It''s the best to modify the question itself and leave the notification in a comment. You should also tag the UI library, for your own good. Please see my last comment to the question.

There are some commercial product offering something similar. Let''s set them aside; if you need you will be able to find them.

The closest and also the most interesting code I saw in this field is this CodeProject article: Virtual Mode TreeListView[^].

Even more valuable is using the virtual mode in this code. It also would allow you to work with huge amount of data as it is not stored in the control.

Also (I would say, just in case), take a look at this CodeProject article: Collapsible ListViewGroup[^].

Good luck,
—SA


这篇关于自定义可扩展ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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