Table of contents
Collapse the table of content
Expand the table of content

Shape.HitTest Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

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


expression . HitTest( xPos , yPos , Tolerance )

expression A variable that represents a Shape object.


NameRequired/OptionalData TypeDescription
xPosRequiredDoubleThe x-coordinate to be tested for a hit.
yPosRequiredDoubleThe y-coordinate to be tested for a hit.
ToleranceRequiredDoubleHow close xPos,yPos must be to a shape for a hit to occur.

Return Value



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 .


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.

© 2018 Microsoft