TreeNodeMouseClickEventArgs クラス
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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
- 継承
次のコード例では、 イベントを処理 NodeMouseDoubleClick する方法と を使用する方法を TreeNodeMouseClickEventArgs示します。 この例を実行するには、 という名前treeView1
の を含む Windows フォームにコードをTreeView貼り付けます。 サンプルが実行されているシステムのディレクトリにあるc:\
ファイルの名前を設定treeView1
し、 のtreeView1_NodeMouseDoubleClick
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
Tree |
TreeNodeMouseClickEventArgs クラスの新しいインスタンスを初期化します。 |
Button |
マウスのどのボタンが押されたかを示す値を取得します。 (継承元 MouseEventArgs) |
Clicks |
マウス ボタンが押されて離された回数を取得します。 (継承元 MouseEventArgs) |
Delta |
マウス ホイールの回転回数を表す符号付きの数値に定数 WHEEL_DELTA の値を乗算した値を取得します。 マウス ホイールのノッチ 1 つ分が 1 移動量に相当します。 (継承元 MouseEventArgs) |
Location |
マウス イベント生成時のマウスの位置を取得します。 (継承元 MouseEventArgs) |
Node |
クリックされたノードを取得します。 |
X |
マウス イベント生成時のマウスの x 座標を取得します。 (継承元 MouseEventArgs) |
Y |
マウス イベント生成時のマウスの y 座標を取得します。 (継承元 MouseEventArgs) |
Equals(Object) |
指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
Get |
既定のハッシュ関数として機能します。 (継承元 Object) |
Get |
現在のインスタンスの Type を取得します。 (継承元 Object) |
Memberwise |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
To |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
製品 | バージョン |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。