TreeViewHitTestInfo.Location プロパティ

定義

TreeView と、これに含まれるノードを基準として、TreeView コントロールにおけるヒット テストの位置を取得します。

public:
 property System::Windows::Forms::TreeViewHitTestLocations Location { System::Windows::Forms::TreeViewHitTestLocations get(); };
public System.Windows.Forms.TreeViewHitTestLocations Location { get; }
member this.Location : System.Windows.Forms.TreeViewHitTestLocations
Public ReadOnly Property Location As TreeViewHitTestLocations

プロパティ値

TreeViewHitTestLocations 値のいずれか 1 つ。

次のコード例では、 プロパティの使用方法 Location を示します。 この例を実行するには、 という名前treeView1のコントロールを含む Windows フォームに次のコードをTreeView貼り付け、 に項目をTreeView設定します。 フォームの MouseDown イベントと イベントが メソッドに関連付けられていることをtreeview1確認しますHandleMouseDown

void HandleMouseDown(object sender, MouseEventArgs e)
{
    TreeViewHitTestInfo info = treeView1.HitTest(e.X, e.Y);
    if (info != null)
        MessageBox.Show("Hit the " + info.Location.ToString());
}
Private Sub HandleMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) _
    Handles Me.MouseDown, treeView1.MouseDown
    Dim info As TreeViewHitTestInfo = treeView1.HitTest(e.X, e.Y)
    If (info IsNot Nothing) Then
        MessageBox.Show("Hit the " + info.Location.ToString())
    End If

End Sub

適用対象