Share via


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

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

語法

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

參數

[in] pen

類型: const Pen*

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

[in, ref] pt1

類型: const POINTF

Bézier 曲線起點的參考。

[in, ref] pt2

類型: const POINTF

Bézier 曲線第一個控制點的參考。

[in, ref] pt3

類型: const POINTF

Bézier 曲線第二個控制點的參考。

[in, ref] pt4

類型: const POINTF

Bézier 曲線結束點的參考。

傳回值

類型: 狀態

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

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

備註

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

範例

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


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

規格需求

需求
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限傳統型應用程式]
最低支援的伺服器 Windows 2000 Server [僅限傳統型應用程式]
目標平台 Windows
標頭 gdiplusgraphics.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

Bézier 曲線

DrawBezier

DrawBeziers 方法

繪圖 Bézier 曲線

圖形

PointF