Shape.DistanceFromPoint Property

Visio Automation Reference

Returns the distance from a shape to a point. Read-only.

Version Information
 Version Added:  Visio 2000

Syntax

expression.DistanceFromPoint(x, y, Flags, [pvPathIndex], [pvCurveIndex], [pvt])

expression   A variable that represents a Shape object.

Parameters

Name Required/Optional Data Type Description
x Required Double An x-coordinate.
y Required Double A y-coordinate.
Flags Required Integer Flags that influence the type of entries returned in results.
pvPathIndex Optional Variant Identifies the point on the shape in conjunction with pvCurveIndex and pvt.
pvCurveIndex Optional Variant Identifies the point on the shape in conjunction with pvPathIndex and pvt.
pvt Optional Variant Identifies the point on the shape in conjunction with pvPathIndex and pvCurveIndex.

Return Value
Double

Remarks

The (x,y) point is expressed in internal drawing units (inches in the drawing) with respect to the coordinate space defined by the sheet immediately containing ThisShape.

The pvPathIndex, pvCurveIndex, and pvt arguments optionally return values that identify the point the returned distance is measured from. Call that point (xOnThis,yOnThis). It lies along the c'th curve of ThisShape's p'th path and can be determined by:

Visual Basic for Applications
      ThisShape.Paths(*pvPathIndex).Item(*pvCurveIndex).Point(*pvt,&xOnThis ,&yOnthis)

You can use the PointAndDerivatives method instead of the Point method if you want to find the first and second derivatives at position t along the curve.

If pvPathIndex or pvCurveIndex is not Null, an Integer (type VT_I4) is returned. If pvt isn't Null, DistanceFromPoint returns a Double (type VT_R8).

The DistanceFromPoint property considers guides to have extent and considers a shape's filled areas and paths.

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 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.

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 the parent object has no geometry, or if Flags excludes consideration of all geometry, the DistanceFromPoint property returns a large number (1E+30) which should be interpreted as infinite.

The DistanceFromPoint property does not consider the width of a shape's line, shadows, line ends, control points, or connection points when computing its result.

See Also