TreeView.ExpandAll 메서드

정의

모든 트리 노드를 확장합니다.

public:
 void ExpandAll();
public void ExpandAll ();
member this.ExpandAll : unit -> unit
Public Sub ExpandAll ()

예제

다음 코드 예제에서는 컨트롤을 검사할 때 컨트롤의 TreeView 모든 트리 노드를 CheckBox 확장 하 고 지워질 때 CheckBox 축소 합니다FirstNode. 이 예제에서는 여러 TreeNode 개체가 있는 컨트롤(TreeView가급적이면 3개 이상의 수준 포함)을 가진 컨트롤 TreeNodeCollection 이 있어야 Form CheckBox합니다.

void myCheckBox_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{

   // If the check box is checked, expand all the tree nodes.
   if ( myCheckBox->Checked == true )
   {
      myTreeView->ExpandAll();
   }
   else
   {

      // If the check box is not checked, collapse the first tree node.
      myTreeView->Nodes[ 0 ]->FirstNode->Collapse();
      MessageBox::Show( "The first node of CustomerList root node is collapsed" );
   }
}
private void myCheckBox_CheckedChanged(object sender, System.EventArgs e)
{
   // If the check box is checked, expand all the tree nodes.
   if (myCheckBox.Checked == true)
   {
      myTreeView.ExpandAll();
   }
   else
   {
      // If the check box is not checked, collapse the first tree node.
      myTreeView.Nodes[0].FirstNode.Collapse();
      MessageBox.Show("The first node of CustomerList root node is collapsed");
   }
}
Private Sub myCheckBox_CheckedChanged(ByVal sender As Object, _
   ByVal e As System.EventArgs) Handles myCheckBox.CheckedChanged
   ' If the check box is checked, expand all the tree nodes.
   If myCheckBox.Checked = True Then
      myTreeView.ExpandAll()
   Else
      ' If the check box is not checked, collapse the first tree node.
      myTreeView.Nodes(0).FirstNode.Collapse()
      MessageBox.Show("The first node of CustomerList root node is collapsed")
   End If
End Sub

설명

이 메서드는 ExpandAll 컨트롤에 TreeNode 있는 모든 자식 트리 노드를 포함하는 모든 개체를 TreeView 확장합니다.

참고

지속 상태 TreeNode 입니다. 예를 들어 메서드를 ExpandAll 호출한 다음 개별 루트 트리 노드가 축소되었다고 가정합니다. 자식 트리 노드는 축소되지 않았으며 루트 트리 노드가 다시 확장될 때 이전에 확장된 상태로 표시됩니다. 메서드를 CollapseAll 호출하면 모든 트리 노드가 축소된 상태로 표시됩니다.

적용 대상

추가 정보