Shapes.AddCurve 方法 (Word)Shapes.AddCurve method (Word)

會傳回代表繪圖畫布中的貝茲曲線的**Shape** 物件。Returns a Shape object that represents a Bézier curve in a drawing canvas.

語法Syntax

運算式AddCurve(SafeArrayOfPoints)expression.AddCurve (SafeArrayOfPoints)

需要 expressionexpression Required. 代表**Shapes** 物件的變數。A variable that represents a Shapes object.

參數Parameters

名稱Name 必要/選用Required/Optional 資料類型Data type 描述Description
SafeArrayOfPointsSafeArrayOfPoints 必要Required VariantVariant 用於指定區線上之頂點和控制點的座標組陣列。An array of coordinate pairs that specifies the vertices and control points of the curve. 所指定的第一個點應是起始頂點,其次兩個點應是第一個貝塞爾段落的控制點。The first point you specify is the starting vertex, and the next two points are control points for the first Bézier segment. 然後,對於曲線的每個貝塞爾段落,指定一個頂點和兩個控制點。Then, for each additional segment of the curve, you specify a vertex and two control points. 所指定的最後一個點應是曲線的終止頂點。The last point you specify is the ending vertex for the curve. 請注意,所指定的點的數目必須是 3n + 1 個,其中 n 為曲線中貝塞爾段落的數目。Note that you must always specify 3n + 1 points, where n is the number of segments in the curve.

傳回值Return value

ShapeShape

範例Example

本範例會將貝茲曲線新增至繪圖畫布中。This example adds a Bézier curve to a new drawing canvas.

Sub CanvasBezier() 
 
 Dim docNew As Document 
 Dim shpCanvas As Shape 
 Dim sngArray(1 To 7, 1 To 2) As Single 
 
 Set docNew = Documents.Add 
 
 'Create a new drawing canvas 
 Set shpCanvas = docNew.Shapes.AddCanvas(Left:=100, _ 
 Top:=100, Width:=300, Height:=50) 
 
 sngArray(1, 1) = 0 
 sngArray(1, 2) = 0 
 sngArray(2, 1) = 50 
 sngArray(2, 2) = 50 
 sngArray(3, 1) = 100 
 sngArray(3, 2) = 0 
 sngArray(4, 1) = 150 
 sngArray(4, 2) = 50 
 sngArray(5, 1) = 200 
 sngArray(5, 2) = 0 
 sngArray(6, 1) = 250 
 sngArray(6, 2) = 50 
 sngArray(7, 1) = 300 
 sngArray(7, 2) = 0 
 
 'Add Bezier curve to drawing canvas 
 shpCanvas.CanvasItems.AddCurve _ 
 SafeArrayOfPoints:=sngArray 
 
End Sub

另請參閱See also

Shapes 集合物件Shapes Collection Object

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.