Shapes.AddPolyline 方法 (Publisher)
將代表開放式聚合線條或封閉多邊形的新 Shape 物件加入至指定 的 Shapes 集合。
語法
運算式。AddPolyline (SafeArrayOfPoints)
expression 代表 Shapes 物件的變數。
參數
名稱 | 必要/選用 | 資料類型 | 描述 |
---|---|---|---|
SafeArrayOfPoints | 必要 | Variant | 用於指定多折線或多邊形區域上的頂點的座標對陣列。 |
傳回值
圖形
註解
對於 SafeArrayOfPoints中的陣列元素,數值會以 點為單位進行評估;字串可以是 Microsoft Publisher (支援的任何單位,例如「2.5 in」) 。
若要建立封閉式多邊形,只要將聚合線繪圖的第一個頂點和最後一個頂點指定為同一座標即可。
範例
下列範例新增三角形到使用中出版物的首頁。 因為起點和終點的座標相同,所以繪製的是閉合的多邊形區域。
Dim shpPolyline As Shape
Dim arrPoints(1 To 4, 1 To 2) As Single
arrPoints(1, 1) = 25
arrPoints(1, 2) = 100
arrPoints(2, 1) = 100
arrPoints(2, 2) = 150
arrPoints(3, 1) = 150
arrPoints(3, 2) = 50
arrPoints(4, 1) = 25
arrPoints(4, 2) = 100
Set shpPolyline = ActiveDocument.Pages(1).Shapes.AddPolyline _
(SafeArrayOfPoints:=arrPoints)
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。