tree view themed scroll bars

G

Guest

(Framework V1.1)

Does the TreeView control not work with Visual styles (as far as the scroll
bars) ?
I have Application.EnableVisualStyles() in my Main method before form
creation, but the tree still displays the boxy gray scrollbars.

Is there a workaround for this?

Dan
 
M

Mick Doherty

Add the following code to Form_Load(assuming your treeview is called
TreeView1):

\\\
Dim TreeWidth As Int32 = TreeView1.Width
TreeView1.Width = 0
TreeView1.Width = TreeWidth
///

You should not actually see the Treeview changing size, but the scrollbar
will have dissapeared from the treeview and will re-appear with VisualStyles
applied when it is needed.

There are more complicated workarounds, but this one works better than any
of the others I have tried.

One exception to that is to move the Treeview1.Nodes.AddRange(...) from
InitializeComponent() to Form_Load()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top