Chart::HitTest Method (Int32, Int32, Boolean)

.NET Framework (current version)
 

Determines the chart element, if any, that is located at a point defined by given X and Y coordinates. Transparent elements can optionally be ignored.

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

public:
HitTestResult^ HitTest(
	int x,
	int y,
	bool ignoreTransparent
)

Parameters

x
Type: System::Int32

The X-coordinate value of the point the user clicked on.

y
Type: System::Int32

The Y-coordinate value of the point the user clicked on.

ignoreTransparent
Type: System::Boolean

true to ignore transparent elements; otherwise, false.

Return Value

Type: System.Windows.Forms.DataVisualization.Charting::HitTestResult^

A HitTestResult object, which provides information concerning the chart element, if any, that is at the specified location.

Call this method to determine the chart element, if any, which is located at a specified point.

To ignore transparent elements, set the ignoreTransparent parameter to true.

The properties of the HitTestResult object that is returned can then be used to determine which chart element was clicked; the HitTestResult object also provides an instance of the actual object selected, if any.

.NET Framework
Available since 4.0
Return to top
Show: