TreeNode.Handle Propiedad

Definición

Obtiene el identificador del nodo de árbol.Gets the handle of the tree node.

public:
 property IntPtr Handle { IntPtr get(); };
[System.ComponentModel.Browsable(false)]
public IntPtr Handle { get; }
member this.Handle : nativeint
Public ReadOnly Property Handle As IntPtr

Valor de propiedad

Identificador del nodo de árbol.The tree node handle.

Atributos

Ejemplos

En el ejemplo de código siguiente TreeNode se obtiene el que se contrajo y se crea una copia Handle de él mediante su propiedad.The following code example gets the TreeNode that was collapsed and creates a copy of it using its Handle property. El original TreeNode se quita TreeNodeCollectionde y la copia se agrega a la colección.The original TreeNode is removed from the TreeNodeCollection, and the copy is added to the collection. Este ejemplo requiere que tenga un Form TreeView control en él.This example requires that you have a Form with a TreeView control on it. El TreeView control debe tener dos o más nodos raíz, cada uno con al menos un nodo secundario.The TreeView control should have two or more root nodes, each having at least one child node.

private:
   void treeView1_AfterCollapse( Object^ /*sender*/, TreeViewEventArgs^ e )
   {
      // Create a copy of the e.Node from its Handle.
      TreeNode^ tn = TreeNode::FromHandle( e->Node->TreeView, e->Node->Handle );
      tn->Text = String::Concat( tn->Text, "Copy" );

      // Remove the e.Node so it can be replaced with tn.
      e->Node->Remove();

      // Add tn to the TreeNodeCollection.
      treeView1->Nodes->Add( tn );
   }
private void treeView1_AfterCollapse(object sender, TreeViewEventArgs e)
{
   // Create a copy of the e.Node from its Handle.
   TreeNode tn = TreeNode.FromHandle(e.Node.TreeView, e.Node.Handle);
   tn.Text += "Copy";
   // Remove the e.Node so it can be replaced with tn.
   e.Node.Remove();
   // Add tn to the TreeNodeCollection.
   treeView1.Nodes.Add(tn);
}
Private Sub treeView1_AfterCollapse(sender As Object, _
  e As TreeViewEventArgs) Handles treeView1.AfterCollapse
   ' Create a copy of the e.Node from its Handle.
   Dim tn As TreeNode = TreeNode.FromHandle(e.Node.TreeView, e.Node.Handle)
   tn.Text += "Copy"
   ' Remove the e.Node so it can be replaced with tn.
   e.Node.Remove()
   ' Add tn to the TreeNodeCollection.
   treeView1.Nodes.Add(tn)
End Sub 

Comentarios

Si aún no se ha creado un identificador cuando Handle se hace referencia a la propiedad, se crea.If a handle is not already created when the Handle property is referenced, it is created.

Se aplica a