Share via


Graphics::D rawBezier (constPen*,REAL,REAL,REAL,REAL) 方法 (gdiplusgraphics.h)

Graphics::D rawBezier 方法繪製 Bézier 曲線。

語法

Status DrawBezier(
  const Pen *pen,
  REAL      x1,
  REAL      y1,
  REAL      x2,
  REAL      y2,
  REAL      x3,
  REAL      y3,
  REAL      x4,
  REAL      y4
);

參數

pen

用來繪製 Bézier 曲線的手寫筆指標。

x1

實數,指定 Bézier 曲線起點的 X 座標。

y1

指定 Bézier 曲線起點的 Y 座標實數。

x2

實數,指定 Bézier 曲線之第一個控制點的 X 座標。

y2

實數,指定 Bézier 曲線第一個控制點的 Y 座標。

x3

實數,指定 Bézier 曲線第二個控制點的 X 座標。

y3

指定 Bézier 曲線第二個控制點的 Y 座標實數。

x4

指定 Bézier 曲線結束點 X 座標的實數。

y4

指定 Bézier 曲線結束點 Y 座標的實數。

傳回值

如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其中一個其他元素。

備註

Bézier 曲線不會通過其控制點。 控制點會做為磁力,以特定方向提取曲線,以影響 Bézier 曲線彎曲的方式。

範例

下列範例會繪製 Bézier 曲線。

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);
}

規格需求

需求
標頭 gdiplusgraphics.h

另請參閱

圖形

DrawBezier

DrawBeziers 方法

繪圖 Bézier 曲線

Bézier 曲線