Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

c# - Windows Forms: Remove empty space left of treeview

I have a treeview that I want to make as minimalist as possible.

        TreeView treeView = new TreeView();
        treeView.Dock = DockStyle.Fill;
        treeView.Margin = new Padding(0);
        treeView.CheckBoxes = true;

default

For my goal, I added these settings (like descripted in this article):

        treeView.ShowRootLines = false;
        treeView.ShowLines = false;
        treeView.ShowPlusMinus = false;
        treeView.Indent = 1;

And still, there is some empty space left of the treeview.

with Properties false

How can it be removed?

Edit: Setting the indent to 0 removes the space for the parent nodes succesfully: enter image description here

That feels a bit weird because Indent is described as "distance to indent each child tree node level". So this approach takes me the possibility to move the child nodes closer to the parent nodes (like in the second image). So instead of moving just the parent to the left, I'd like to move parent + childs to the left.

question from:https://stackoverflow.com/questions/65915376/windows-forms-remove-empty-space-left-of-treeview

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...