How do I make a TreeNode not visible? (C#)

拈花ヽ惹草 提交于 2019-12-01 19:50:59

I don't think you can do that. There is an IsVisible property, but it is readonly and will indicate whether the node is currently visible within the client area of the TreeView control. I think you will need to remove it from the nodes collection in which it resides (and optionally remember the position of it to be able to restore it.

Hmm... I originally (and incorrectly) mentioned IsVisible. However, on inspection I expect the answer is simply: don't add it until you need it.

This is easier if your UI model is an abstraction above your actual data model, so you can store items in the data model regardless of their visibility, and simply update the UI (add/remove/update nodes) as necessary.

I don't think you can. You'll have to remove the node.

Node.PrevVisibleNode;

I think this means visible as in it's visible to the user (all parent nodes are expanded)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!