Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programmatically scroll TreeView?

I need to scroll TreeView (Windows Forms) from TOP to BOTTOM...

I should clarify that I have two TreeViews... If the first was scrolled by the user, the second treeView must be automatically scrolled. I don't know what node is selected...

How can I do this?

like image 261
Yuriy Avatar asked Feb 25 '11 16:02

Yuriy


1 Answers

For top node:

TreeView.Nodes[0].EnsureVisible();

For bottom node:

TreeView.Nodes[TreeView.Nodes.Count-1].EnsureVisible();
like image 121
WraithNath Avatar answered Oct 11 '22 21:10

WraithNath