Shape.RerouteConnections 方法 (Publisher)

重置连接符,使它们可以采用最短的路径连接的形状。 若要执行此操作, RerouteConnections 方法可能会分离接头两端并将它们重新连接到已连接的形状上的不同连接站点。

语法

表达式RerouteConnections

表达 一个代表 Shape 对象的变量。

备注

此方法将重排连接在指定形状上的所有连接符;如果指定的形状是连接符,就重排该连接符。

示例

以下示例将两个矩形添加到当前出版物的第一页,并用曲线连接符将它们连接起来。 请注意,RerouteConnections 方法将替代为 BeginConnectEndConnect 方法一起使用的 ConnectionSite 参数提供的值。

Dim shpRect1 As Shape 
Dim shpRect2 As Shape 
 
With ActiveDocument.Pages(1).Shapes 
 
 ' Add two new rectangles. 
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _ 
 Left:=100, Top:=50, Width:=200, Height:=100) 
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _ 
 Left:=300, Top:=300, Width:=200, Height:=100) 
 
 ' Add a new curved connector. 
 With .AddConnector(Type:=msoConnectorCurve, _ 
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _ 
 .ConnectorFormat 
 
 ' Connect the new connector to the two rectangles. 
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1 
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1 
 
 ' Reroute the connector to create the shortest path. 
 .Parent.RerouteConnections 
 End With 
 
End With 

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。