Skip to main content
A newer version of this page is available. .

MapControl.CalcHitInfo(Point) Method

Returns information on the map elements located at the specified point.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v20.2.dll

NuGet Package: DevExpress.Win.Map

Declaration

public MapHitInfo CalcHitInfo(
    Point hitPoint
)

Parameters

Name Type Description
hitPoint Point

The hit point, relative to the map’s top-left edge integer screen coordinates.

Returns

Type Description
MapHitInfo

The object containing information about the map elements located at the hit point.

Remarks

Use the CalcHitInfo method to determine which element is located at the specified hit point. For instance, this can be used when handling the map’s MouseDown event to determine which element was clicked. In such cases, pass the current mouse pointer’s coordinates as the method’s parameter.

Note

The returned MapHitInfo object does not contain the test point location in map coordinates. To obtain the location, use the MapControl.ScreenPointToCoordPoint method.

Example

mapControl1.MouseClick += OnMapControlMouseClick;
//...
private void OnMapControlMouseClick(object sender, MouseEventArgs e) {
    MapHitInfo info = mapControl1.CalcHitInfo(e.Location);
    if (info.InMapSpline) {
        gridControl1.DataSource = info.MapSpline.Points;           
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CalcHitInfo(Point) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also