共用方式為


Page.DropConnected Method (Visio)

Creates a new Shape object on the page, places the new shape relative to the specified existing target shape, and adds a connector from the existing shape to the new shape. Returns the newly created shape.

Version Information

Version Added: Visio 2010

Syntax

expression .DropConnected(ObjectToDrop, TargetShape, PlacementDir, [Connector])

expression A variable that represents a Page object.

Parameters

Name

Required/Optional

Data Type

Description

ObjectToDrop

Required

[UNKNOWN]

The shape to add to the page. Can be a Master, MasterShortcut, Shape, or an IDataObject object.

TargetShape

Required

Shape

The existing shape from which to align, space, and connect.

PlacementDir

Required

VisAutoConnectDir

The direction from TargetShape in which to place ObjectToDrop.

Connector

Optional

[UNKNOWN]

The connector to use. Can be a Master, MasterShortcut, Shape, or an IDataObject object.

Return Value

Shape

Remarks

The ObjectToDrop parameter must be an object that references a two-dimensional (2-D) shape. If you pass a selection of shapes represented by an IDataObject object, Visio uses only the first of those shapes. If ObjectToDrop is not a valid Visio object, Visio returns an Invalid Parameter error. If ObjectToDrop is not a shape that matches the context of the method, Visio returns an Invalid Source error.

The TargetShape parameter must be a 2-D top-level shape on the page. If TargetShape is invalid, Visio returns an Invalid Source error.

The PlacementDir parameter value must be one of the VisAutoConnectDir constants. If you pass visAutoConnectDirNone for PlacementDir, Visio places the shape in a default location (0,0) and then connects it; the shape is not placed in relation to the target.

The Connector parameter must be an object that references a one-dimensional (1-D) routable shape. If you pass a selection of shapes represented by an IDataObject object, Visio uses only the first of those shapes. If Connector is not a valid Visio object, Visio returns an Invalid Parameter error. If Connector is not a shape that matches the context of the method, Visio returns an Invalid Source error.