TreeNodeMouseClickEventArgs TreeNodeMouseClickEventArgs TreeNodeMouseClickEventArgs TreeNodeMouseClickEventArgs Class

定义

提供有关 NodeMouseClickNodeMouseDoubleClick 事件的数据。Provides data for the NodeMouseClick and NodeMouseDoubleClick events.

public ref class TreeNodeMouseClickEventArgs : System::Windows::Forms::MouseEventArgs
public class TreeNodeMouseClickEventArgs : System.Windows.Forms.MouseEventArgs
type TreeNodeMouseClickEventArgs = class
    inherit MouseEventArgs
Public Class TreeNodeMouseClickEventArgs
Inherits MouseEventArgs
继承
TreeNodeMouseClickEventArgsTreeNodeMouseClickEventArgsTreeNodeMouseClickEventArgsTreeNodeMouseClickEventArgs

示例

下面的代码示例演示如何处理NodeMouseDoubleClick事件以及如何使用TreeNodeMouseClickEventArgsThe following code example demonstrates how to handle the NodeMouseDoubleClick event and how to use the TreeNodeMouseClickEventArgs. 若要运行此示例,请将代码粘贴到包含一个 Windows 窗体TreeView名为treeView1To run this example, paste the code into a Windows Form that contains a TreeView named treeView1. 填充treeView1中的文件的名称c:\系统,运行该示例的目录,并关联NodeMouseDoubleClick的事件treeView1treeView1_NodeMouseDoubleClick在此示例中的方法。Populate treeView1 with the names of files located in the c:\ directory of the system the sample is running on, and associate the NodeMouseDoubleClick event of treeView1 with the treeView1_NodeMouseDoubleClick method in this example.

    // 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.");
        }
    }
// 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.");
    }
}
' 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

构造函数

TreeNodeMouseClickEventArgs(TreeNode, MouseButtons, Int32, Int32, Int32) TreeNodeMouseClickEventArgs(TreeNode, MouseButtons, Int32, Int32, Int32) TreeNodeMouseClickEventArgs(TreeNode, MouseButtons, Int32, Int32, Int32) TreeNodeMouseClickEventArgs(TreeNode, MouseButtons, Int32, Int32, Int32)

初始化 TreeNodeMouseClickEventArgs 类的新实例。Initializes a new instance of the TreeNodeMouseClickEventArgs class.

属性

Button Button Button Button

获取曾按下的是哪个鼠标按钮。Gets which mouse button was pressed.

(Inherited from MouseEventArgs)
Clicks Clicks Clicks Clicks

获取按下并释放鼠标按钮的次数。Gets the number of times the mouse button was pressed and released.

(Inherited from MouseEventArgs)
Delta Delta Delta Delta

获取鼠标轮已转动的制动器数的有符号计数乘以 WHEEL_DELTA 常数。Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DELTA constant. 制动器是鼠标轮的一个凹口。A detent is one notch of the mouse wheel.

(Inherited from MouseEventArgs)
Location Location Location Location

获取鼠标在产生鼠标事件时的位置。Gets the location of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)
Node Node Node Node

获取被单击的节点。Gets the node that was clicked.

X X X X

获取鼠标在产生鼠标事件时的 x 坐标。Gets the x-coordinate of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)
Y Y Y Y

获取鼠标在产生鼠标事件时的 y 坐标。Gets the y-coordinate of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于