Aracılığıyla paylaş


TreeViewHitTestInfo.Location Özellik

Tanım

Denetimdeki TreeView isabet testinin konumunu, içerdiği düğümlerle TreeView ilişkili olarak alır.

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

Özellik Değeri

TreeViewHitTestLocations değerlerinden biri.

Örnekler

Aşağıdaki kod örneği özelliğinin nasıl kullanılacağını Location gösterir. Bu örneği çalıştırmak için, aşağıdaki kodu adlı treeView1denetimi içeren bir TreeView Windows Formuna yapıştırın ve öğesini öğelerle doldurunTreeView. Formun treeview1 ve olayının MouseDown yöntemiyle ilişkilendirildiğinden HandleMouseDown emin olun.

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

Şunlara uygulanır