TreeNode.IsVisible Property
.NET Framework 4
Gets a value indicating whether the tree node is visible or partially visible.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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.
private void button3_Click(object sender, System.EventArgs e) { TreeNode lastNode = treeView1.Nodes[treeView1.Nodes.Count - 1]. Nodes[treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Count - 1]; if (!lastNode.IsVisible) { lastNode.EnsureVisible(); MessageBox.Show(lastNode.Text + " tree node is visible."); } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.