Shapes.AddCurve method (Project)
Adds a Bézier curve to a report, and returns a Shape object that represents the curve.
Syntax
expression. AddCurve
(SafeArrayOfPoints)
expression A variable that represents a Shapes object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the vertices and control points of the curve. |
SafeArrayOfPoints | Required | Variant |
Return value
Shape
Remarks
For the SafeArrayOfPoints parameter, 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. Note that you must always specify 3 n + 1 points, where n is the number of segments in the curve.
Example
The following example creates a curve that has seven vertices, starting at the upper-left corner of the report. The curve is set to a yellow-green line that is two points wide.
Sub AddBezierCurve()
Dim shapeReport As Report
Dim reportName As String
Dim curveShape As shape
' Add a report.
reportName = "Curve report"
Set shapeReport = ActiveProject.Reports.Add(reportName)
Dim pts(1 To 7, 1 To 2) As Single
pts(1, 1) = 0
pts(1, 2) = 0
pts(2, 1) = 72
pts(2, 2) = 72
pts(3, 1) = 100
pts(3, 2) = 40
pts(4, 1) = 20
pts(4, 2) = 50
pts(5, 1) = 90
pts(5, 2) = 120
pts(6, 1) = 60
pts(6, 2) = 30
pts(7, 1) = 150
pts(7, 2) = 90
Set curveShape = shapeReport.Shapes.AddCurve(pts)
With curveShape
.Line.Weight = 2
.Line.ForeColor.RGB = &H1FFAA
End With
End Sub
See also
Shapes Object Shape Object Line Property
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.