共用方式為


Shape.DrawPolyline 方法 (Visio)

會建立路徑是沿著指定的一組點組成的多折線之圖形。

語法

expressionDrawPolyline( _xyArray()_ , _Flags_ )

expression 一個用於表示 Shape 物件的變數。

參數

名稱 必要/選用 資料類型 描述
xyArray () 必要 雙精確度 交替的 xy 值的陣列,這些值會定義新圖形路徑中的點。
Flags 必要 整數 會影響圖形繪製方法的旗標。

傳回值

圖形

註解

DrawPolyline 方法會建立一個新的圖形,此圖形的路徑是由線段的序列所組成,而此圖形的結束點會符合 xyArray 中所指定的點。 呼叫 DrawPolyline 方法相當於呼叫容錯值為零 (0) 且具有 visSplineAbrupt 旗標的 DrawSpline 方法。

控制點應位於內部繪圖單元中,相對於新圖形所建立的頁面、母版或群組的座標空間) (英吋。 傳遞的陣列應為由參考 (VT_R8| 傳遞的 8 位元組浮點數 SAFEARRAY 類型VT_ARRAY|VT_BYREF) 。 這就是 Microsoft Visual Basic 將陣列傳遞給自動化物件的方式。

Flags 引數是一個指定繪製新圖形之選項的位元遮罩。 其值可包含 visPolyline1D (8) 或 visPolyarcs (256) 。 如果 Flags 包括:

  • visPolyline1D ,如果 xyArray 中的第一個和最後一個點不重合, DrawPolyline 方法會產生一個一維 (一維) 行為的形狀;否則,它會產生具有二維 (二維) 行為的形狀。

  • visPolyarcs,Microsoft Visio 將會產生弧線的序列,而非線段的序列;xyArray 必須指定此序列的初始 x,y 點,後面接著三個一組的 x,y 弧形。 Visio 將會產生一個包含 EllipticalArcTo 資料列的圖形 (在這些資料列中,弧線的弧度會符合指定的值)。

如果 xyArray 中的第一個點和最後一個點重疊,則 DrawPolyline 方法會產生填滿的圖形。

範例

以下範例展示了如何在活動頁面上分別繪製兩個具有 2D 和 1D 行為的多條線形狀。

 
Public Sub DrawPolyline_Example() 
 
 Dim vsoShape As Visio.Shape 
 Dim adblXYPoints(1 To 8) As Double 
 Dim intCounter As Integer 
 
 'Initialize array with coordinates. 
 adblXYPoints(1) = 1 
 adblXYPoints(2) = 1 
 adblXYPoints(3) = 3 
 adblXYPoints(4) = 3 
 adblXYPoints(5) = 5 
 adblXYPoints(6) = 1 
 adblXYPoints(7) = 1 
 adblXYPoints(8) = 2 
 
 'Use the DrawPolyline method to draw a shape that has 2D behavior. 
 Set vsoShape = ActivePage.DrawPolyline(adblXYPoints, 0) 
 
 'Increase the Y-coordinate of the array by 4 to separate 
 'the next shape drawn from the first. 
 For intCounter = 2 To UBound(adblXYPoints) Step 2 
 adblXYPoints(intCounter) = adblXYPoints(intCounter) + 4 
 Next intCounter 
 
 'Use the DrawPolyline method to draw a shape that has 1D behavior. 
 Set vsoShape = ActivePage.DrawPolyline(adblXYPoints, visPolyline1D) 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應