TreeNodeMouseClickEventArgs (Clase) (System.Windows.Forms)

Cambiar vista:
Sin script
Biblioteca de clases de .NET Framework
TreeNodeMouseClickEventArgs (Clase)

Actualización: noviembre 2007

Proporciona los datos de los eventos NodeMouseClick y NodeMouseDoubleClick.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
Sintaxis

Visual Basic (Declaración)
Public Class TreeNodeMouseClickEventArgs _
	Inherits MouseEventArgs
Visual Basic (Uso)
Dim instance As TreeNodeMouseClickEventArgs
C#
public class TreeNodeMouseClickEventArgs : MouseEventArgs
Visual C++
public ref class TreeNodeMouseClickEventArgs : public MouseEventArgs
J#
public class TreeNodeMouseClickEventArgs extends MouseEventArgs
JScript
public class TreeNodeMouseClickEventArgs extends MouseEventArgs
Ejemplos

En el siguiente ejemplo de código se muestra cómo controlar el evento NodeMouseDoubleClick y cómo utilizar TreeNodeMouseClickEventArgs. Para ejecutar este ejemplo, pegue el código en un formulario Windows Forms que contenga un control TreeView denominado treeView1. Rellene el control treeView1 con los nombres de archivos ubicados en el directorio c:\ del sistema en el que se esté ejecutando el ejemplo y asocie el evento NodeMouseDoubleClick de treeView1 al método treeView1_NodeMouseDoubleClick de este ejemplo.

Visual Basic
' If a node is double-clicked, open the file indicated by the TreeNode.
Sub treeView1_NodeMouseDoubleClick(ByVal sender As Object, _
    ByVal e As TreeNodeMouseClickEventArgs) _
    Handles treeView1.NodeMouseDoubleClick

    Try
        ' Look for a file extension, and open the file.
        If e.Node.Text.Contains(".") Then
            System.Diagnostics.Process.Start("c:\" + e.Node.Text)
        End If
        ' If the file is not found, handle the exception and inform the user.
    Catch
        MessageBox.Show("File not found.")
    End Try

End Sub 'treeView1_NodeMouseDoubleClick



C#
// If a node is double-clicked, open the file indicated by the TreeNode.
void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
    try
    {
        // Look for a file extension.
        if (e.Node.Text.Contains("."))
            System.Diagnostics.Process.Start(@"c:\" + e.Node.Text);
    }
        // If the file is not found, handle the exception and inform the user.
    catch (System.ComponentModel.Win32Exception)
    {
        MessageBox.Show("File not found.");
    }
}


Visual C++
    // If a node is double-clicked, open the file indicated by the TreeNode.
private:
    void InitialTreeView_NodeMouseDoubleClick(Object^ sender,
        TreeNodeMouseClickEventArgs^ e)
    {
        try
        {
            // Look for a file extension.
            if (e->Node->Text->Contains("."))
            {
                System::Diagnostics::Process::Start("c:\\" + e->Node->Text);
            }
        }
        // If the file is not found, handle the exception and inform the user.
        catch (System::ComponentModel::Win32Exception^)
        {
            MessageBox::Show("File not found.");
        }
    }


Jerarquía de herencia

System.Object
  System.EventArgs
    System.Windows.Forms.MouseEventArgs
      System.Windows.Forms.TreeNodeMouseClickEventArgs
Seguridad para subprocesos

Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.
Plataformas

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Información de versión

.NET Framework

Compatible con: 3.5, 3.0, 2.0
Vea también

Referencia