Share via


DistanceFrom Property [Visio 2003 SDK Documentation]

Returns the distance from one shape to another. Both shapes must be on the same page or in the same master.

doubleRet = object**.DistanceFrom**(otherShape, flags)**

doubleRet     Double. A distance in internal drawing units with respect to the coordinate space defined by the parent shape.

object     Required. An expression that returns a Shape object.

otherShape     Required. The other Shape object involved in the comparison.

flags     Required Integer. Flags that influence the type of entries returned in results.

Version added

2000

Remarks

The DistanceFrom property returns:

  • Zero and raises an exception if the shapes being compared are in different masters or on different pages.
  • Zero if the shapes being compared are overlapping.
  • Zero if one shape contains the other shape or one shape is contained within the other shape.

The flags argument can be any combination of the values of the constants defined in the following table. These constants are also defined in VisSpatialRelationFlags in the Microsoft Office Visio 2003 type library.

Constant Value Description

visSpatialIncludeHidden

&H10

Consider hidden Geometry sections. By default, hidden Geometry sections do not influence the result.

visSpatialIgnoreVisible

&H20

Do not consider visible Geometry sections. By default, visible Geometry sections influence the result.

Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

If object or otherShape has no geometry, or if flags excludes consideration of all geometry of either shape, the DistanceFrom property returns a large number (1E+30) that should be construed as infinite.

The DistanceFrom property does not consider the width of a shape's line, shadows, line ends, control points, or connection points when comparing two shapes.

Applies to | Shape object

See Also | DistanceFromPoint property | SpatialNeighbors property | SpatialRelation property