TreeNodeMouseClickEventArgs 類別

定義

提供 NodeMouseClickNodeMouseDoubleClick 事件的資料。

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
繼承
TreeNodeMouseClickEventArgs

範例

下列程式碼範例示範如何處理 NodeMouseDoubleClick 事件,以及如何使用 TreeNodeMouseClickEventArgs 。 若要執行此範例,請將程式碼貼到包含 TreeView 具名 treeView1 的 Windows Form 中。 treeView1填入範例執行所在 c:\ 系統目錄中的檔案名,並將 的 事件 treeView1 與此 treeView1_NodeMouseDoubleClick 範例中的 方法產生關聯 NodeMouseDoubleClick

    // 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

建構函式

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

初始化 TreeNodeMouseClickEventArgs 類別的新執行個體。

屬性

Button

取得按下哪個滑鼠鍵的資訊。

(繼承來源 MouseEventArgs)
Clicks

取得按下並釋放滑鼠鍵的次數。

(繼承來源 MouseEventArgs)
Delta

取得滑鼠滾輪滾動時帶有正負號的刻度數乘以 WHEEL_DELTA 常數。 一個刻度是一個滑鼠滾輪的刻痕。

(繼承來源 MouseEventArgs)
Location

取得滑鼠在產生滑鼠事件期間的位置。

(繼承來源 MouseEventArgs)
Node

取得按下的節點。

X

取得滑鼠在產生滑鼠事件期間的 X 座標。

(繼承來源 MouseEventArgs)
Y

取得滑鼠在產生滑鼠事件期間的 Y 座標。

(繼承來源 MouseEventArgs)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於