Selection.DrawRegion method (Visio)

Draws a new shape that represents the region containing a given point.

Syntax

expression. DrawRegion( _Tolerance_ , _Flags_ , _x_ , _y_ , _ResultsMaster_ )

expression A variable that represents a Selection object.

Parameters

Name Required/Optional Data type Description
Tolerance Required Double Error tolerance when determining the coincidence of points. A distance expressed in internal units in the coordinate space of the Selection object's containing shape; the maximum gap between paths that is tolerated when constructing the boundaries of a region.
Flags Required Integer A constant or integer that specifies how to draw the region.
x Optional Variant x-coordinate in internal units in the coordinate space of the Selection object.
y Optional Variant y-coordinate in internal units in the coordinate space of the Selection object.
ResultsMaster Optional Variant The Master object which the new Shape object should be an instance of.

Return value

Shape

Remarks

The DrawRegion method creates a new Shape object from pieces of the paths in the Selection object.

  • If both x and y are specified, the resulting shape is the smallest region that contains the point ( x, y).

  • In the absence of either x or y, or if the point ( x, y) is not contained in any region enclosed by the paths of the selected shapes, the result is the union of all the shapes that would have been created by using the Fragment operation.

  • If no closed region is defined by the selected shapes, the DrawRegion method returns Nothing and raises no exception.

The Flags argument can be one or a combination of the following constants declared by the Visio type library in VisDrawRegionFlags.

**Name ** Value Description
visDrawRegionDeleteInput &H4 Delete items in selection.
visDrawRegionIgnoreVisible &H20 Exclude visible geometry.
visDrawRegionIncludeDataGraphics &H40 Include data graphic callout shapes and their sub-shapes.
visDrawRegionIncludeHidden &H10 Include hidden geometry.

If the DrawRegion method is passed a ResultsMaster of type VT_EMPTY or VT_ERROR (which is how VBA passes an unspecified optional argument), the new shape is not an instance of a master and the fill, line, and text styles of the new region are set to the document's default styles.

If the DrawRegion method is passed a reference to a Master object in ResultsMaster (type VT_UNKNOWN or VT_DISPATCH), the DrawRegion method instances that Master object and adds geometry computed given the Selection object.

The new Shape object has no text other than text already in ResultsMaster.

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.