TreeView Scrollbars

3xodus

Freshman
Joined
Dec 26, 2004
Messages
47
Location
Derbyshire, UK
Hi again :)

I've spent too much time reading around for information on this, and trying for myself.. I know it's probably something obvious that I'm not going to find..

I have a TreeView that scrolls vertically due to the amount of nodes, but *dosen't* scroll horizontally as there are no nodes wide enough to need it.

However as a part of my app I have to set TreeView.Scrollable = false;, and later on, back to = true;. When Scrollable = true again, there's a vertical and horizontal scrollbar. None of the nodes have changed, they're all still far from needing horizontal scrolling. It seems that setting the .Scrollable property to true at runtime just automatically adds both scrollbars.

As a side not, the horizontal scrollbar won't even actually scroll. Just to show how pointless it is that it even appears :)

Is it possible to get rid of the horizontal, and leave the vertical one there? I can't see any properties for this, but I'm hoping there's something...

Thanks for any info guys ;)

[EDIT @ 19th July, 21:30]
I've still not found anything on this unfortunately, however my problem is solved as I've found an alternative way of doing it...

I'm still interested to see if this is possible though, if anyone knows.
 
Last edited:
Did you account for the width of the vertical scroll bar in the sizing of the treeview width? I think the Windows default widths are 16 for Win 2K and 17 for XP.
 
Thanks for your thoughts, though my treeview is more than wide enough. The treeview's width is 197, much wider than any of the nodes. I've tested with nodes 1 character in length, and the result is the same.

I am now fairly sure that setting the .Scrollable property to true at runtime just adds both scrollbars regardless of the contents of the treeview. Since I'm using C# 2005 beta 2, I'm hoping that the option is added in the final release to choose scrollbars (maybe boolean treeView.HScrollable and treeView.VScrollable) though it's not such a big deal.
 
Last edited:
Back
Top