How to scroll TreeNode programmatically in WinForms TreeView?
Selection node
In the WinForms TreeView, to scroll a particular TreeNodeAdv or to ensure that it is visible programmatically, you can use the functions BringIntoView and EnsureVisible.
C#
//Shows the parent node of the selected node. this.treeViewAdv1.SelectedNode.Parent.BringIntoView(); //Shows the particular node. this.treeViewAdv1.Nodes[0].Nodes[this.treeViewAdv1.Nodes[0].Nodes.Count - 1].BringIntoView(); //EnsureVisible function also used to show the parent node of the selected node. this.treeViewAdv1.EnsureVisible(treeViewAdv1.SelectedNode.Parent);
VB
'Shows the parent node of the selected node. Me.treeViewAdv1.SelectedNode.Parent.BringIntoView() 'Shows the particular node. Me.treeViewAdv1.Nodes(0).Nodes(Me.treeViewAdv1.Nodes(0).Nodes.Count - 1).BringIntoView() 'EnsureVisible function also used to show the parent node of the selected node Me.treeViewAdv1.EnsureVisible(treeViewAdv1.SelectedNode.Parent) 'EnsureVisible function also used to show the particular node Me.treeViewAdv1.EnsureVisible(Me.treeViewAdv1.Nodes(0).Nodes(treeViewAdv1.Nodes(0).Nodes.Count - 1))
Samples:
Reference link: https://help.syncfusion.com/windowsforms/treeview/treenodeadvcustomization#nodeselection
Conclusion
I hope you enjoyed learning how to choose the best grid in WinForms Grid Control.
You can refer to WinForms Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Grid example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!