GraphicsPath::AddCurve method

The GraphicsPath::AddCurve method adds a cardinal spline to the current figure of this path.


Status AddCurve(
  IN const PointF *points,
  IN INT          count



Pointer to an array of points that define the cardinal spline. The cardinal spline is a curve that passes through each point in the array.


Integer that specifies the number of elements in the points array.

Return Value

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.


You should keep a copy of the points array if those points will be needed later. The GraphicsPath object does not store the points passed to the AddClosedCurve method; instead, it converts the cardinal spline to a sequence of Bézier splines and stores the points that define those Bézier splines. You cannot retrieve the original array of points from the GraphicsPath object.


The following example creates a GraphicsPath object path, adds a cardinal spline to path, and then draws path.

VOID AddCurveExample(HDC hdc)
   Graphics graphics(hdc);
   PointF pts[] = {PointF(50.0f, 50.0f),
                   PointF(60.0f, 20.0f),
                   PointF(70.0f, 100.0f),
                   PointF(80.0f, 50.0f)};
   GraphicsPath path;
   path.AddCurve(pts, 4);
   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);


Header gdipluspath.h

See Also

AddBezier Methods

AddBeziers Methods

AddCurve Methods

Bézier Splines

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient

Drawing Bézier Splines