Shape.HitTest Method

Visio Automation Reference

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

Version Information
 Version Added:  Visio 4.5

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.

See Also