Shape.RerouteConnections 方法 (Publisher)
變更連接器的路徑使它們採取所連接的圖形之間的最短可能路徑。 若要這樣做, RerouteConnections 方法可能會中斷連線的連接器端點和重新其附加至不同的連線站台上連接的圖形。
語法
運算式。RerouteConnections
表達 代表 Shape 物件的變數。
註解
這個方法會重設連接到指定圖案之所有連接線的路徑;如果指定的圖案是連接線,就會重設此連接線的路徑。
範例
在這個範例中,會將兩個矩形新增至使用中出版物的第一頁,並以弧形連接線連接這兩個矩形。 請注意,RerouteConnections方法會覆寫您針對搭配 BeginConnect和EndConnect方法使用的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 支援與意見反應。