Export (0) Print
Expand All

TreeViewHitTestInfo.Location Property

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft