TreeNode.IsVisible Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a value indicating whether the tree node is visible or partially visible.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

<BrowsableAttribute(False)>
Public ReadOnly Property IsVisible As Boolean

Property Value

Type: System.Boolean

true if the tree node is visible or partially visible; otherwise, false.

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 Sub button3_Click(sender As Object, _
  e As System.EventArgs) Handles button3.Click
   Dim lastNode as TreeNode
   lastNode = treeView1.Nodes(treeView1.Nodes.Count - 1). _
     Nodes(treeView1.Nodes(treeView1.Nodes.Count - 1).Nodes.Count - 1)

   If Not lastNode.IsVisible Then
      lastNode.EnsureVisible()
      MessageBox.Show(lastNode.Text & _
        " tree node is visible.")
   End If
End Sub

.NET Framework
Available since 1.1
Return to top
Show: