Ensures that the tree node is visible, expanding tree nodes and scrolling the tree view control as necessary.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
When the method is called, the tree is expanded and scrolled to ensure that the current tree node is visible in the TreeView. This method is useful if you are selecting a tree node in code based on certain criteria. By calling this method after you select the node, the user can see and interact with the selected node.
If the TreeView.ItemHeight property is set to a value that is larger than the height of the tree view control, calling this method has unexpected results.
The following code example brings the last child tree node of the last root tree node into view in the tree view when a button is clicked. This example requires that you have a TreeView control on a Form that contains a collection of TreeNode objects, and a Button. There should be enough tree nodes so that they are not all visible in the tree view control.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.