TreeView::HitTest Method (Int32, Int32)
.NET Framework (current version)
Provides node information, given x- and y-coordinates.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- x
-
Type:
System::Int32
The x-coordinate at which to retrieve node information
- y
-
Type:
System::Int32
The y-coordinate at which to retrieve node information.
Use this method to determine whether a set of x- and y-coordinates is located in a TreeNode and where within the node the point is located, such as on the label or image area.
The following code example code demonstrates how to use the Level, Node, and HitTest members. To run this example, create a Windows Form that contains a TreeView named treeView1 and populate it with several levels of nodes. Paste the following code into the form and associate the MouseDown event of treeView1 with the treeView1_MouseDown method in this example.
.NET Framework
Available since 2.0
Available since 2.0
Show: