This document is archived and information here might be outdated.  Recommended version.


IActiveView.HitTestMap Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IA > IActiveView Interface > IActiveView.HitTestMap Method
ArcGIS Developer Help

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
);
[C++]
Parameters
Location [in]

Location is a parameter of type IPoint*

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