TreeNodeMouseClickEventArgs クラス

定義

NodeMouseClickイベントとNodeMouseDoubleClick イベントのデータを提供します。

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 フォームにコードを貼り付けます。 サンプルが実行されているシステムのtreeView1 ディレクトリにあるファイルの名前をc:\に設定し、NodeMouseDoubleClicktreeView1 イベントをこの例のtreeView1_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定数を乗算した符号付きカウントを取得します。 ディテントは、マウス ホイールの 1 つのノッチです。

(継承元 MouseEventArgs)
Location

生成中のマウス イベント中のマウスの位置を取得します。

(継承元 MouseEventArgs)
Node

クリックされたノードを取得します。

X

生成するマウス イベント中のマウスの x 座標を取得します。

(継承元 MouseEventArgs)
Y

生成するマウス イベント中のマウスの y 座標を取得します。

(継承元 MouseEventArgs)

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象