Graphics::D rawBezier 方法绘制贝塞尔样条。
语法
Status DrawBezier(
  const Pen *pen,
  REAL      x1,
  REAL      y1,
  REAL      x2,
  REAL      y2,
  REAL      x3,
  REAL      y3,
  REAL      x4,
  REAL      y4
);
参数
pen
指向用于绘制贝塞尔样条的笔的指针。
x1
指定贝塞尔样条曲线起点的 x 坐标的实数。
y1
指定贝塞尔样条曲线起点的 y 坐标的实数。
x2
实数,指定贝塞尔样条曲线第一个控制点的 x 坐标。
y2
指定贝塞尔样条第一个控制点的 y 坐标的实数。
x3
实数,指定贝塞尔样条第二个控制点的 x 坐标。
y3
指定贝塞尔样条第二个控制点的 y 坐标的实数。
x4
指定贝塞尔样条曲线终点的 x 坐标的实数。
y4
指定贝塞尔样条曲线终点的 y 坐标的实数。
返回值
如果方法成功,则返回 Ok,这是 Status 枚举的元素。
如果 方法失败,它将返回 Status 枚举的其他元素之一。
注解
贝塞尔样条不通过其控制点。 控制点充当磁体,向特定方向拉动曲线,以影响贝塞尔样条的弯曲方式。
示例
以下示例绘制贝塞尔曲线。
VOID Example_DrawBezier4(HDC hdc)
{
   Graphics graphics(hdc);
   // Set up the pen and curve points.
   Pen greenPen(Color(255, 0, 255, 0));
   REAL startPointx = 100.0f;
   REAL startPointy = 100.0f;
   REAL ctrlPoint1x = 200.0f;
   REAL ctrlPoint1y = 10.0f;
   REAL ctrlPoint2x = 350.0f;
   REAL ctrlPoint2y = 50.0f;
   REAL endPointx = 500.0f;
   REAL endPointy = 100.0f;
   //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);
}
要求
| 要求 | 值 | 
|---|---|
| Header | gdiplusgraphics.h |