Shape.SpatialRelation Property
Visio Automation Reference |
Returns an integer that represents the spatial relationship of one shape to another shape. Both shapes must be on the same page or in the same master. Read-only.
Version Information
Version Added: Visio 2000
Syntax
expression.SpatialRelation(OtherShape, Tolerance, Flags)
expression A variable that represents a Shape object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
OtherShape | Required | [IVSHAPE] | The other Shape object involved in the comparison. |
Tolerance | Required | Double | A distance in internal drawing units with respect to the coordinate space defined by the Shape object's parent. |
Flags | Required | Integer | Flags that influence the result. See Remarks for the values of this argument. |
Return Value
Integer
Remarks
- The interger returned can be any combination of the values defined in VisSpatialRelationCodes in the Visio type library. The SpatialRelation property returns zero (0) if the two shapes being compared are not in any of the relationships discussed in the table in the VisSpatialRelationCodes topic.
- The Flags argument can be any combination of the values of the constants defined in the following table. These constants are declared in VisSpatialRelationFlags in the Visio type library.
Constant Value Description visSpatialIncludeDataGraphics
&H40
Includes data graphic callout shapes and their sub-shapes. By default, data graphic callout shapes and their subshapes are not included. If the parent shape is itself a data graphic callout, searches are made between the parent shape's geometry and non-callout shapes, unless this flag is set.
visSpatialIncludeGuides
&H2
Considers a guide's Geometry section. By default, guides do not influence the result.
visSpatialIncludeHidden
&H10
Considers hidden Geometry sections. By default, hidden Geometry sections do not influence the result.
visSpatialIgnoreVisible
&H20
Does not consider visible Geometry sections. By default, visible Geometry sections influence the result.
![]() |
---|
When it compares two shapes, the SpatialRelation property does not consider the width of a shape's line, shadows, line ends, control points, or connection points. |
Example
This Microsoft Visual Basic for Applications (VBA) example shows how to use the SpatialRelation property in an event handler for the ShapeAdded event to determine the spatial relationship between shapes.
Before adding the following code to your VBA project, make sure there is at least one shape on the drawing page. Then, after adding the code, add another shape to your drawing.
Visual Basic for Applications |
---|
|
See Also