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

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

語法

Status DrawBezier(
  [in]      const Pen     *pen,
  [in, ref] const Point & pt1,
  [in, ref] const Point & pt2,
  [in, ref] const Point & pt3,
  [in, ref] const Point & pt4
);

參數

[in] pen

類型:const Pen*

用來繪製貝氏曲線的畫筆指標。

[in, ref] pt1

類型:const POINT

Bézier 曲線起點的參考。

[in, ref] pt2

類型:const POINT

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

[in, ref] pt3

類型:const POINT

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

[in, ref] pt4

類型:const POINT

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

傳回值

類型:狀態

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

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

言論

貝塞爾曲線不會通過其控制點。 控制點充當磁石,以特定方向拉曲線,以影響貝塞爾曲線彎曲的方式。

例子

下列範例會繪製貝塞爾曲線。


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

   // Set up the pen and curve points.
   Pen greenPen(Color(255, 0, 255, 0));
   Point startPoint(100, 100);
   Point controlPoint1(200, 10);
   Point controlPoint2(350, 50);
   Point endPoint(500, 100);

   //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 [僅限傳統型應用程式]
目標平臺 窗戶
標頭 gdiplusgraphics.h (包括 Gdiplus.h)
連結庫 Gdiplus.lib
DLL Gdiplus.dll

另請參閱

貝塞爾曲線

DrawBezier

DrawBeziers 方法

繪製貝氏曲線

圖形

手寫筆