Export (0) Print
Expand All

Chart.HitTest Method (Int32, Int32, ChartElementType)

Determines if a chart element of a given type is located at a point defined by given X and Y coordinates.

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

public HitTestResult HitTest(
	int x,
	int y,
	ChartElementType requestedElement
)

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.

requestedElement
Type: System.Windows.Forms.DataVisualization.Charting.ChartElementType

A flag that determines the chart element type to be tested.

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 if a chart element of the given type is located at a specified point.

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

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft