如何隐藏TVirtualStringTree节点? [英] How can I hide a TVirtualStringTree node?
问题描述
如果我没有记错的话,则不可能在 TVirtualStringTree树视图,因为没有启用,可见或其他 这样做的属性.我对吗?
if I'm not mistaken it's not possible to have invisible nodes in a TVirtualStringTree treeview, as there are no enabled, visible or other properties to do so. Am I right about this?
如果是,我如何设法拥有一个不可见的节点?
If yes, how did I manage to have a non visible node?
我的树的结构:
- 一个节点
- 另一个节点
- 子节点1
- 子节点2
- ...
- 子节点15
- 子节点16(不可见!)
- One Node
- Another node
- Subnode 1
- Subnode 2
- ...
- Subnode 15
- Subnode 16 (which is not visible!)
- 另一个节点的子节点1
- 子节点2 来自另一个节点
- Subnode 1 from yet another node
- Subnode 2 from yet another node
当我在 整棵树,然后让我打印第一列的文本.我可以 还检查节点,看看他有一个先前的兄弟姐妹,但是没有 例如下一个兄弟节点,节点高度为18.
I can find Subnode 16 when I do a FirstNode/GetNextNode loop over the whole tree and let me print out the text for the first column. I can also inspect the node and see that he's got a previous sibling but no next sibling for instance and the node height is 18.
那我怎么做到的?
推荐答案
如果我没记错的话,那么在TVirtualStringTree树视图中就不可能有不可见的节点,因为没有启用的,可见的或其他属性.我对吗?
if I'm not mistaken it's not possible to have invisible nodes in a TVirtualStringTree treeview, as there are no enabled, visible or other properties to do so. Am I right about this?
您错了,可能同时存在不可见节点和禁用节点.要切换节点的可见状态,请使用
You are wrong, it is possible to have both invisible and disabled nodes. To switch visible state of the node use
vtree.IsVisible[Node] := boolean;
启用/禁用节点使用
vtree.IsDisabled[Node] := boolean;
还可以通过将
ivsDisabled
添加到InitialStates
参数,在树的OnInitNode
事件中将节点初始化为禁用状态.You can also initialize node to disabled state in tree's
OnInitNode
event with addingivsDisabled
toInitialStates
parameter.这篇关于如何隐藏TVirtualStringTree节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!