Shape.HitTest method (Visio)

Determines if a given x,y position hits outside, inside, or on the boundary of a shape.

Syntax

expression. HitTest( _xPos_ , _yPos_ , _Tolerance_ )

expression A variable that represents a Shape object.

Parameters

Name Required/Optional Data type Description
xPos Required Double The x-coordinate to be tested for a hit.
yPos Required Double The y-coordinate to be tested for a hit.
Tolerance Required Double How close xPos,yPos must be to a shape for a hit to occur.

Return value

Integer

Remarks

The HitTest method considers only visible geometry and ignores hidden geometry.

Use internal drawing units (inches in the drawing) for the xPos, yPos, and Tolerance values. These values should also be in, and with respect to, the coordinate space of the page, master, or group shape that contains the shape being hit tested.

The following are possible values returned by the HitTest method, and are declared by the Visio type library in VisHitTestResults.

Constant Value
visHitOutside 0
visHitOnBoundary 1
visHitInside 2

Data graphic callout shapes (and their sub-shapes) that are applied to the parent shape are excluded from hit-test calculations. If the parent shape is itself a data graphic callout shape, its geometry (and that of its sub-shapes) is not excluded from hit-test calculations.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.