隐藏 WinForms TreeView 加号 [英] Hide WinForms TreeView plus sign
问题描述
我有一个带有一个主节点和几个子节点的 WinForms TreeView.
I have a WinForms TreeView with one main node and several sub-nodes.
如何隐藏主节点中的+(加号)?
How can I hide the + (plus sign) in the main node?
推荐答案
Treview 属性:.ShowRootLines = false
Treview Property: .ShowRootLines = false
当 ShowRootLines
为 false 时,加号/减号不会在根节点上显示,但必要时仍会在子节点上显示.
When ShowRootLines
is false, the Plus/Minus sign will not be shown for the root node, but will still show when necessary on child nodes.
在隐藏加号/减号的情况下,您可以考虑在树填充后执行根节点的 Expand()
方法.这将确保根节点显示所有一级子节点.
With the Plus/Minus sign hidden, you might consider executing the Expand()
method of the root node once the tree is populated. That will make sure that the root node shows all first-level child nodes.
注意:TreeView 上有一个 ShowPlusMinus
属性,但它适用于所有节点.
Note: There is a ShowPlusMinus
property on the TreeView, but it works on all nodes.
这篇关于隐藏 WinForms TreeView 加号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!