ArcObjects Library Reference (Carto)  

IActiveView.HitTestMap Method

Returns any maps present in the view at the given location. Return value may be zero if there are no maps or the coordinate is not over a map.

[Visual Basic .NET]
Public Function HitTestMap ( _
    ByVal Location As IPoint _
) As IMap
[C#]
public IMap HitTestMap (
    IPoint Location
);
[C++]
HRESULT HitTestMap(
  IPoint* Location,
  IMap** Map
);
[C++]

Parameters

Location [in]

  Location is a parameter of type IPoint

Map [out, retval]

  Map is a parameter of type IMap

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

Use this method on a PageLayout to find the nearest Map based on a point location.  For example, when ArcMap's identify tool is used in Layout view, the tool first finds the Map clicked on before it searches for features in the Map.

When using this method on a PageLayout, for the Location parameter, set up the Point in page coordinates. To convert from device coordinates to page coordinates:

  1. Get the ScreenDisplay from the PageLayout using IActiveView::ScreenDisplay.
  2. Get the DisplayTransformation from the ScreenDisplay using IScreenDisplay::DisplayTransformation.
  3. Convert device coordinates (for example from a mouse move) to page coordinates using IDisplayTransformation::ToMapPoint.

Use this method on a Map to obtain a reference to it through IMap.

See Also

IActiveView Interface