Treeview防止节点崩溃
我有一个 .net 2.0 C# 项目。 我有一个有 2 个节点的 Treeview,每个节点都有许多子节点。 单击子节点时,Web 浏览器控件中会根据该节点的属性显示 PDF。 很好,但问题是,当两个节点都展开时,我单击一个子节点,另一个节点就会折叠! 我没有任何代码可以折叠树视图的任何节点,但不知何故它发生了! 我还查看了 BeforeCollapse 事件,但不知何故它没有触发,尽管其他节点崩溃了!
谁能想象为什么会发生这种情况? 如果有人能教我如何防止这种情况发生,我将非常感激!
非常感谢!
I have a .net 2.0 C# Project.
I have a Treeview with 2 Nodes, each of them has many child nodes.
When you click on a child node, a PDF is displayed in a webbrowser control depending on the properties of the node.
Fine, but the problem is that when both Nodes are expanded, and I click on a child node, the other node gets collapsed! I don't have any code that collapses any node of the treeview, but somehow it happens! I also had a look at the BeforeCollapse Event, but somehow it doesn't fire, alltough the other node collapses!
Can anyone imagine why this happens?
I would be very grateful if anyone can teach me how to prevent this happening!
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于 WinForms TreeView 的限制和怪癖,我不久前就停止使用它了。
我最喜欢的替代品是开源 TreeViewAdv:
Source Forge 上的 TreeViewAdv
CodeProject 上的 TreeViewAdv
I stopped using the WinForms TreeView some time ago because of it's limits and quirks.
My favorite replacement is the open-source TreeViewAdv:
TreeViewAdv on Source Forge
TreeViewAdv on CodeProject
如果树视图的 TVS_SINGLEEXPAND 样式为 ON,则会发生这种情况。 尝试将 HotTracking 属性设置为 false。
This happens if the TVS_SINGLEEXPAND style is ON for the treeview. Try setting the HotTracking property to false.