c# WinForms 检测 TreeView 的真实可见性
我有一个 WinForms TreeView 和一棵树,由继承 TreeNode 的自定义节点对象构建,问题是这些节点一次只能显示在一棵树中。 现在我有多个带有 TreeView 的控件,应该显示这些节点。如何指示显示treeView? 我可以捕获 VisibleChanged 事件,但我不知道如何检测 TreeView 是否真正可见(可见属性不会改变!)。
我知道一种解决方案是将我的数据包装在 TreeNode 对象中,而不是使用 TreeNode 的继承。但我希望有一个更快的解决方案。
I have a WinForms TreeView and a tree, built from custom node objects which inherits TreeNode the problem is that these nodes can be displayed in only one tree at the time.
Now I have multiple controls with a TreeView that should display these nodes. How can I indicate that the treeView is displayed?
I can catch the VisibleChanged event but I don't know how to detect if the TreeView is really visible (The visible property does not change!).
I know that one solution can be to wrap my data in TreeNode objects and not using inheritance from TreeNode. But I hope there is a faster solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您如何决定哪个树视图显示项目?
一般来说,我认为这根本不是一个好的设计。最好使用
FeedTreeNode(MyObject o)
和合适的更新程序。How do you decide which treeview gets to display the items?
Generally, I don't think that's a good design at all. Better use an
FeedTreeNode(MyObject o)
and a suitable updater.