TreeViewHitTestInfo.Location Właściwość

Definicja

Pobiera lokalizację testu trafienia w kontrolce TreeView w odniesieniu do TreeView węzłów, które zawiera.

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

Wartość właściwości

Jedna z TreeViewHitTestLocations wartości.

Przykłady

W poniższym przykładzie kodu pokazano, jak używać Location właściwości. Aby uruchomić ten przykład, wklej następujący kod do formularza systemu Windows, który zawiera kontrolkę TreeView o nazwie treeView1, i wypełnij element TreeView elementami. Upewnij się, że treeview1 i MouseDown zdarzenie formularza są skojarzone z HandleMouseDown metodą .

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

Dotyczy