如何使树视图不可折叠? [英] How to make a treeview uncollapsable?

查看:32
本文介绍了如何使树视图不可折叠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WinForms中使用TreeView控件,有没有可以设置隐藏每个节点的折叠节点图标的属性?

Using the TreeView control in WinForms, is there a property that can be set to hide the collapse-node icons for each node?

另外,如何永久展开 TreeView 中的所有节点?

Also, how do I permanently expand all nodes in the TreeView?

推荐答案

您需要处理 OnBeforeExpand 事件并将 Cancel 设置为 true>.

You would need to handle the OnBeforeExpand event and set Cancel to true.

private void OnBeforeExpand(TreeViewCancelEventArgs e)
{
   e.Cancel = true;
}

请记住,这会阻止任何树节点扩展.

Keep in mind that this would prevent any tree node from expanding.

如果您想隐藏+/-"符号,您应该将 ShowPlusMinus 属性设置为 false.

If you want to hide the "+/-" symbols, you should set the ShowPlusMinus property to false.

这篇关于如何使树视图不可折叠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆