windowsforms-devexpress-dot-xtramap-dot-mapcontrol-dot-calchitinfo-x28-system-dot-drawing-dot-point-x29.md
Returns information on the map elements located at the specified point.
Namespace : DevExpress.XtraMap
Assembly : DevExpress.XtraMap.v25.2.dll
NuGet Package : DevExpress.Win.Map
public MapHitInfo CalcHitInfo(
Point hitPoint
)
Public Function CalcHitInfo(
hitPoint As Point
) As MapHitInfo
| Name | Type | Description |
|---|---|---|
| hitPoint | Point |
The hit point, relative to the map’s top-left edge integer screen coordinates.
|
| Type | Description |
|---|---|
| MapHitInfo |
The object containing information about the map elements located at the hit point.
|
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.
mapControl1.MouseClick += OnMapControlMouseClick;
//...
private void OnMapControlMouseClick(object sender, MouseEventArgs e) {
MapHitInfo info = mapControl1.CalcHitInfo(e.Location);
if (info.InMapSpline) {
gridControl1.DataSource = info.MapSpline.Points;
}
}
mapControl1.MouseClick += OnMapControlMouseClick
'...
Private Sub OnMapControlMouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim info As MapHitInfo = mapControl1.CalcHitInfo(e.Location)
If info.InMapSpline Then
gridControl1.DataSource = info.MapSpline.Points
End If
End Sub
See Also