MapControl.CalcHitInfo(Point) Method
Returns information on the map elements located at the specified point.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v24.2.dll
NuGet Package: DevExpress.Win.Map
#Declaration
public MapHitInfo CalcHitInfo(
Point hitPoint
)
#Parameters
Name | Type | Description |
---|---|---|
hit |
Point | The hit point, relative to the map’s top-left edge integer screen coordinates. |
#Returns
Type | Description |
---|---|
Map |
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 Map
#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;
}
}