DrawBezier(Pen*,INT,INT,INT,INT,INT,INT,INT,INT)

Graphics.DrawBezier(const Pen*, INT, INT, INT, INT, INT, INT, INT, INT) method

Applies to: desktop apps only

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

Syntax

Status DrawBezier(
  [in]  const Pen *pen,
  [in]  INT x1,
  [in]  INT y1,
  [in]  INT x2,
  [in]  INT y2,
  [in]  INT x3,
  [in]  INT y3,
  [in]  INT x4,
  [in]  INT y4
);

Parameters

pen [in]

Type: const Pen*

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

x1 [in]

Type: INT

Integer that specifies the x-coordinate of the starting point of the Bézier spline.

y1 [in]

Type: INT

Integer that specifies the y-coordinate of the starting point of the Bézier spline.

x2 [in]

Type: INT

Integer that specifies the x-coordinate of the first control point of the Bézier spline.

y2 [in]

Type: INT

Integer that specifies the y-coordinate of the first control point of the Bézier spline

x3 [in]

Type: INT

Integer that specifies the x-coordinate of the second control point of the Bézier spline.

y3 [in]

Type: INT

Integer that specifies the y-coordinate of the second control point of the Bézier spline.

x4 [in]

Type: INT

Integer that specifies the x-coordinate of the ending point of the Bézier spline.

y4 [in]

Type: INT

Integer that specifies the y-coordinate of the ending point of the Bézier spline

Return value

Type:

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_DrawBezier3(HDC hdc)
{
   Graphics graphics(hdc);

   // Set up the pen and curve points.
   Pen greenPen(Color(255, 0, 255, 0));
   int startPointx = 100;
   int startPointy = 100;
   int ctrlPoint1x = 200;
   int ctrlPoint1y = 10;
   int ctrlPoint2x = 350;
   int ctrlPoint2y = 50;
   int endPointx = 500;
   int endPointy = 100;

   //Draw the curve.
   graphics.DrawBezier(
   &greenPen,
   startPointx,
   startPointy,
   ctrlPoint1x,
   ctrlPoint1y,
   ctrlPoint2x,
   ctrlPoint2y,
   endPointx,
   endPointy);

   //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

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics
DrawBezier
DrawBeziers Methods
Pen
Drawing Bézier Splines
Bézier Splines

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2016 Microsoft