Share via


Graphics::D rawBeziers (constPen*,constPointF*,INT) 方法 (gdiplusgraphics.h)

Graphics::D rawBeziers 方法會繪製連接 Bézier 曲線的序列。

語法

Status DrawBeziers(
  const Pen    *pen,
  const PointF *points,
  INT          count
);

參數

pen

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

points

PointF 物件的陣列指標,指定 Bézier 曲線的開始、結束和控制點。

count

整數,指定 陣列中的項目數目。

傳回值

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

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

備註

Bézier 曲線不會通過其控制點。 控制點會做為磁力,以特定方向提取曲線,以影響 Bézier 曲線彎曲的方式。 每個 Bézier 曲線都需要起點和終點。 每個結束點都是下一個 Bézier 曲線的起點。

範例

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

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

   // Define a Pen object and an array of PointF objects.
   Pen greenPen(Color(255, 0, 255, 0), 3);

   PointF startPoint(100.0f, 100.0f);
   PointF ctrlPoint1(200.0f, 50.0f);
   PointF ctrlPoint2(400.0f, 10.0f);
   PointF endPoint1(500.0f, 100.0f);
   PointF ctrlPoint3(600.0f, 200.0f);
   PointF ctrlPoint4(700.0f, 400.0f);
   PointF endPoint2(500.0f, 500.0f);

   PointF curvePoints[7] = {
      startPoint,
      ctrlPoint1,
      ctrlPoint2,
      endPoint1,
      ctrlPoint3,
      ctrlPoint4,
      endPoint2};

   // Draw the Bezier curves.
   graphics.DrawBeziers(&greenPen, curvePoints, 7);

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

規格需求

需求
標頭 gdiplusgraphics.h

另請參閱

Bézier 曲線

DrawBezier 方法

繪圖 Bézier 曲線

DrawBeziers

圖形

PointF