Chart.HitTest Method (Int32, Int32)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Determines the chart element, if any, that is located at a point defined by the 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


Type: System.Int32

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

Type: System.Int32

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

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.

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