Assembly: System.Windows.Forms (in system.windows.forms.dll)
Public Sub ExpandAll
Dim instance As TreeNode instance.ExpandAll
public void ExpandAll ()
public: void ExpandAll ()
public void ExpandAll ()
public function ExpandAll ()
Il metodo ExpandAll espande tutti i nodi figli della struttura assegnati all'insieme Nodes.
Nell'esempio di codice riportato di seguito vengono espansi tutti i nodi della struttura di un controllo TreeView quando un controllo CheckBox è selezionato e viene compressa la proprietà FirstNode quando il controllo CheckBox è deselezionato. Per eseguire questo esempio è necessario disporre di un oggetto Form con un oggetto CheckBox e di un controllo TreeView con un insieme TreeNodeCollection contenente numerosi oggetti TreeNode preferibilmente in tre o più livelli.
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 cheked, collapse the first tree node. myTreeView.Nodes(0).FirstNode.Collapse() MessageBox.Show("The first and last node of CutomerList root node is collapsed") End If End Sub
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 cheked, collapse the first tree node. myTreeView.Nodes[0].FirstNode.Collapse(); MessageBox.Show("The first and last node of CutomerList root node is collapsed"); } }
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 cheked, collapse the first tree node. myTreeView->Nodes[ 0 ]->FirstNode->Collapse(); MessageBox::Show( "The first and last node of CutomerList 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.get_Checked() == true) {
myTreeView.ExpandAll();
}
else {
// If the check box is not cheked, collapse the first tree node.
myTreeView.get_Nodes().get_Item(0).get_FirstNode().Collapse();
MessageBox.Show("The first and last node of CutomerList root "
+ "node is collapsed");
}
} //myCheckBox_CheckedChanged
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile per Pocket PC, Windows Mobile per Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema.
Nota