简体   繁体   English

如何在C#Winforms中删除TreeView的空白?

[英]How to remove blank spaces of treeview in c# winforms?

在此处输入图片说明

In above diagram the name 'sebin joseph' is in a treeview. 在上图中,名称“ sebin joseph”在树状视图中。

Make treeview ShowLines property to false . 将treeview的ShowLines属性设置为false

How to remove left side space from treeview as in the above diagram? 如上图所示,如何从树状视图中删除左侧空间?

You can remove the left side space by setting ShowRootLines property to false . 您可以通过将ShowRootLines属性设置为false来删除左侧空间。

But note that it will also remove the plus/minus from the root nodes, so the only way to expand/collapse them would be the double click or using keyboard. 但是请注意,它还会从根节点中删除加号/减号,因此展开/折叠它们的唯一方法是双击或使用键盘。

It is the Property Indent that you want to change: 您要更改的是属性缩进

treeView1.Indent = 5;

Also, ShowPlusMinus takes some of the space, if you want you can remove it: 另外, ShowPlusMinus会占用一些空间,如果您愿意,可以将其删除:

treeView1.ShowPlusMinus = false;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM