TreeNode.IsVisible Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應