Graphics::DrawBezier(constPen*,constPointF&,constPointF&,constPointF&,constPointF&) method (gdiplusgraphics.h)

The Graphics::DrawBezier method draws a Bézier spline.

Syntax

Status DrawBezier(
  [in]      const Pen      *pen,
  [in, ref] const PointF & pt1,
  [in, ref] const PointF & pt2,
  [in, ref] const PointF & pt3,
  [in, ref] const PointF & pt4
);

Parameters

[in] pen

Type: const Pen*

Pointer to a pen that is used to draw the Bézier spline.

[in, ref] pt1

Type: const POINTF

Reference to the starting point of the Bézier spline.

[in, ref] pt2

Type: const POINTF

Reference to the first control point of the Bézier spline.

[in, ref] pt3

Type: const POINTF

Reference to the second control point of the Bézier spline.

[in, ref] pt4

Type: const POINTF

Reference to the ending point of the Bézier spline.

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.

Remarks

A Bézier spline does not pass through its control points. The control points act as magnets, pulling the curve in certain directions to influence the way the Bézier spline bends.

Examples

The following example draws a Bézier curve.


VOID Example_DrawBezier2(HDC hdc)
{
   Graphics graphics(hdc);

   // Set up the pen and curve points.
   Pen greenPen(Color(255, 0, 255, 0));
   PointF startPoint(100.0f, 100.0f);
   PointF controlPoint1(200.0f, 10.0f);
   PointF controlPoint2(350.0f, 50.0f);
   PointF endPoint(500.0f, 100.0f);

   //Draw the curve.
   graphics.DrawBezier(&greenPen, startPoint, controlPoint1, controlPoint2, endPoint);

   //Draw the end points and control points.
   SolidBrush redBrush(Color(255, 255, 0, 0));
   SolidBrush blueBrush(Color(255, 0, 0, 255));
   graphics.FillEllipse(&redBrush, 100 - 5, 100 - 5, 10, 10);
   graphics.FillEllipse(&redBrush, 500 - 5, 100 - 5, 10, 10);
   graphics.FillEllipse(&blueBrush, 200 - 5, 10 - 5, 10, 10);
   graphics.FillEllipse(&blueBrush, 350 - 5, 50 - 5, 10, 10);
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusgraphics.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Bézier Splines

DrawBezier

DrawBeziers Methods

Drawing Bézier Splines

Graphics

Pen

PointF