TreeViewHitTestInfo.Location Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the location of a hit test on a TreeView control, in relation to the TreeView and the nodes it contains.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public TreeViewHitTestLocations Location { get; }

The following code example demonstrates how to use the Location property. To run this example, paste the following code into a Windows Form that contains a TreeView control named treeView1, and populate the TreeView with items. Ensure that treeview1 and the MouseDown event for the form are associated with the HandleMouseDown method.

void HandleMouseDown(object sender, MouseEventArgs e)
{
    TreeViewHitTestInfo info = treeView1.HitTest(e.X, e.Y);
    if (info != null)
        MessageBox.Show("Hit the " + info.Location.ToString());
}

.NET Framework
Available since 2.0
Return to top
Show: