TreeViewHitTestInfo.Location Propriété

Définition

Obtient l'emplacement d'un test d'atteinte sur un contrôle TreeView en fonction du TreeView et des nœuds qu'il contient.

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

Valeur de propriété

Une des valeurs de l'objet TreeViewHitTestLocations.

Exemples

L’exemple de code suivant montre comment utiliser la Location propriété . Pour exécuter cet exemple, collez le code suivant dans un Windows Form qui contient un TreeView contrôle nommé treeView1, puis remplissez le TreeView avec des éléments. Vérifiez que treeview1 et l’événement MouseDown du formulaire sont associés à la HandleMouseDown méthode .

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

S’applique à