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


IElement.HitTest Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IE > IElement Interface > IElement.HitTest Method
ArcGIS Developer Help

IElement.HitTest Method

Indicates if the given x and y coordinates are contained by the element.

[Visual Basic .NET]
Public Function HitTest ( _
    ByVal x As Double, _
    ByVal y As Double, _
    ByVal Tolerance As Double _
) As Boolean
[C#]
public bool HitTest (
    double x,
    double y,
    double Tolerance
);
[C++]
HRESULT HitTest(
  double x,
  double y,
  double Tolerance
);
[C++]
Parameters
x [in]

x is a parameter of type double y [in]
y is a parameter of type double Tolerance [in]
Tolerance is a parameter of type double

Product Availability

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

Remarks

HitTest returns a boolean value indicating whether or not the current element is intersected by the specified coordinate pair and tolerance distance.  For instance, if we have a line element selected, the HitTest is determining whether that line element is within the specified tolerance from the given X and Y.  A value of TRUE is returned if the element is within the tolerance, while FALSE is returned if it is not.

The X,Y, and tolerance values should be specified in map units.

 

See Also

IElement Interface