Table of contents
TOC
折叠目录
展开目录

ConnectorFormat.EndConnect 方法 (PowerPoint)ConnectorFormat.EndConnect Method (PowerPoint)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

将指定的连接符的终点连接到指定的形状上。Attaches the end of the specified connector to a specified shape.

语法Syntax

表达式EndConnect( ConnectedShapeConnectionSite )expression. EndConnect( ConnectedShape, ConnectionSite )

表达式_一个表示ConnectorFormat对象的变量。_expression A variable that represents a ConnectorFormat object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
ConnectedShapeConnectedShape必需Required形状Shape要连接到连接符的终点的形状。指定的形状对象必须是同一与连接器的Shapes集合中。The shape to attach the end of the connector to. The specified Shape object must be in the same Shapes collection as the connector.
ConnectionSiteConnectionSite必需RequiredLongLong由 ConnectedShape 指定的形状上的连接点。必须是 1 到指定形状的ConnectionSiteCount属性返回的整数之间的整数。如果您想要自动查找最短的路径连接两个形状之间的连接器,指定该参数的任何有效的整数,并将RerouteConnections方法后连接器附着在两端的形状。A connection site on the shape specified by ConnectedShape. Must be an integer between 1 and the integer returned by the ConnectionSiteCount property of the specified shape. If you want the connector to automatically find the shortest path between the two shapes it connects, specify any valid integer for this argument and then use the RerouteConnections method after the connector is attached to shapes at both ends.

注解Remarks

如果已存在的连接符的终点与另一个形状之间的连接,该连接会断开。如果连接符的终点没有位于指定的连接位置,此方法将连接符的终点移到该连接结点,并调整连接符的位置和大小。使用BeginConnect方法将连接符的起点连接到形状。If there's already a connection between the end of the connector and another shape, that connection is broken. If the end of the connector isn't already positioned at the specified connecting site, this method moves the end of the connector to the connecting site and adjusts the size and position of the connector. Use the BeginConnect method to attach the beginning of the connector to a shape.

将连接符连接到某个对象以后,该连接符的大小和位置将在必要时进行自动调整。When you attach a connector to an object, the size and position of the connector are automatically adjusted, if necessary.

示例Example

本示例向当前演示文稿第一张幻灯片中添加两个矩形,并用曲线连接符将它们连接起来。请注意, RerouteConnections方法可以使这不相关与BeginConnectEndConnect方法使用 ConnectionSite 参数提供的值。This example adds two rectangles to the first slide in the active presentation and connects them with a curved connector. Notice that the RerouteConnections method makes it irrelevant what values you supply for the ConnectionSite arguments used with the BeginConnect and EndConnect methods.

Set myDocument = ActivePresentation.Slides(1)

Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)

With s.AddConnector(msoConnectorCurve, 0, 0, 100, 100) _
        .ConnectorFormat
    .BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
    .EndConnect ConnectedShape:=secondRect, ConnectionSite:=1
    .Parent.RerouteConnections
End With

另请参阅See also

概念Concepts

ConnectorFormat 对象ConnectorFormat Object

© 2018 Microsoft