TreeNode.ExpandAll Methode

Definitie

Hiermee worden alle onderliggende structuurknooppunten uitgebreid.

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

Voorbeelden

In het volgende codevoorbeeld worden alle structuurknooppunten in een TreeView besturingselement uitgevouwen wanneer een CheckBox besturingselement is ingeschakeld en wordt de FirstNode optie samengevouwen wanneer het CheckBox is gewist. In dit voorbeeld moet u een Form met een CheckBoxen een TreeView besturingselement hebben met een besturingselement TreeNodeCollection met verschillende TreeNode objecten (bij voorkeur met drie of meer niveaus).

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

   // If the check box is checked, expand all the tree nodes.
   if ( myCheckBox->Checked )
   {
      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)
   {
      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

Opmerkingen

De ExpandAll methode breidt alle onderliggende structuurknooppunten uit die zijn toegewezen aan de Nodes verzameling.

Note

De status van een TreeNode bestand blijft behouden. Als het volgende niveau van onderliggende knooppunten bijvoorbeeld niet eerder is samengevouwen, worden de onderliggende knooppunten weergegeven in Expand de eerder uitgevouwen status.

Van toepassing op

Zie ook