TreeNode.ExpandAll 메서드

정의

자식 트리 노드를 모두 확장합니다.

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

예제

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

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 컬렉션에 할당된 모든 자식 트리 노드를 Nodes 확장합니다.

참고

상태가 TreeNode 유지됩니다. 예를 들어 이전에 다음 수준의 자식 노드가 축소되지 않은 경우 메서드가 Expand 호출될 때 자식 노드는 이전에 확장된 상태로 표시됩니다.

적용 대상

추가 정보