TreeView.ExpandAll Yöntem

Tanım

Tüm ağaç düğümlerini genişletir.

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

Örnekler

Aşağıdaki kod örneği, denetlendiğinde denetimdeki TreeView tüm ağaç düğümlerini genişletir ve temizlendiğinde CheckBox öğesini FirstNode daralttır.CheckBox Bu örnek, ile bir FormCheckBoxTreeView ve birkaç TreeNode nesnesi olan bir denetiminiz TreeNodeCollection olmasını gerektirir (tercihen üç veya daha fazla düzeyle).

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

Açıklamalar

ExpandAll yöntemi, denetimdeki TreeNode tüm alt ağaç düğümlerini TreeView içeren tüm nesneleri genişletir.

Not

Bir durumunu TreeNode kalıcı. Örneğin, yöntemini çağırdığınızda ExpandAll tek tek kök ağaç düğümlerinin daraltıldığını varsayalım. Alt ağaç düğümleri daraltılmamıştır ve kök ağaç düğümleri yeniden genişletildiğinde önceden genişletilmiş durumunda görünür. yöntemini çağırmak CollapseAll , tüm ağaç düğümlerinin daraltılmış durumda görünmesini sağlar.

Şunlara uygulanır

Ayrıca bkz.