TreeViewHitTestInfo Class
TOC
Collapse the table of content
Expand the table of content

TreeViewHitTestInfo Class

 

Contains information about an area of a TreeView control or a TreeNode.

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

System.Object
  System.Windows.Forms.TreeViewHitTestInfo

Public Class TreeViewHitTestInfo

NameDescription
System_CAPS_pubmethodTreeViewHitTestInfo(TreeNode, TreeViewHitTestLocations)

Initializes a new instance of the TreeViewHitTestInfo class.

NameDescription
System_CAPS_pubpropertyLocation

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

System_CAPS_pubpropertyNode

Gets the TreeNode at the position indicated by a hit test of a TreeView control.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The TreeViewHitTestInfo is returned by the TreeView class when the HitTest method is called.

The following code example demonstrates how to use the TreeViewHitTestInfo class. 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.

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

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft