Publisher) (ConnectorFormat.BeginConnect 方法
會將所指定接點的起點附加到指定的圖案上。
語法
運算式。BeginConnect (ConnectedShape, ConnectionSite)
表達 代表 ConnectorFormat 物件的 變數。
參數
名稱 | 必要/選用 | 資料類型 | 描述 |
---|---|---|---|
ConnectedShape | 必要 | Shape | Microsoft Publisher 將連接線的起點附加的圖形。 指定的 Shape 物件必須是連接線相同 Shapes 集合中。 |
ConnectionSite | 必要 | Long | ConnectedShape所指定圖案上的連接網站。 必須是圖案的介於 1 到指定 ConnectionSiteCount 屬性所傳回的整數之間的整數。 連接位置編號從所指定圖案的頂端開始及逆時鐘環繞圖形。 如果您想要自動尋找其連接兩個圖形之間的最短路徑的連接器,指定此引數的任何有效整數和之後連接器會連接到圖形於兩端,然後使用 RerouteConnections 方法。 |
註解
如果已經是連接線的起點與另一個圖形之間的連線,該連線會中斷。 如果連接線的起點不在所需的連接節點上,本方法將把接點的起點移到該連接節點,並對接點的大小和位置作相應的調整。
將連接線連線到某一物件上時,該接點的尺寸和位置都將自動作必要調整。
使用 EndConnect 方法可將連接線的終點連到圖形上。
範例
在這個範例中,會將兩個矩形新增至使用中出版物的第一頁,並以弧形連接線連接這兩個矩形。 請注意,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 支援與意見反應。