Uredi

Deli z drugimi prek


TreeNode.IsVisible Property

Definition

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

public:
 property bool IsVisible { bool get(); };
public bool IsVisible { get; }
[System.ComponentModel.Browsable(false)]
public bool IsVisible { get; }
member this.IsVisible : bool
[<System.ComponentModel.Browsable(false)>]
member this.IsVisible : bool
Public ReadOnly Property IsVisible As Boolean

Property Value

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

Attributes

Examples

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.

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( String::Concat( lastNode->Text, " tree node is visible." ) );
   }
}
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.");
   }
}
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

Applies to

See also