DrawRegion method

Microsoft Visio Developer Reference

DrawRegion method

See also   Example   

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

Version added

2000

Syntax

objRet = object.DrawRegion(tolerance, flags, [x], [y], [ResultsMaster])

objRet

A Shape object.

object

Required. An expression that returns a Selection object.

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.

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 using the Fragment operation.
  • If no closed region is defined by the selected shapes, then 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.

visDrawRegionIncludeHidden

&H10

Include hidden geometry.

visDrawRegionIgnoreVisible

&H20

Exclude visible 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) , then 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.