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

Graphics::D rawBeziers 方法會繪製一連串連接的貝塞爾曲線。

語法

Status DrawBeziers(
  [in] const Pen   *pen,
  [in] const Point *points,
  [in] INT         count
);

參數

[in] pen

類型:const Pen*

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

[in] points

類型:const Point*

Point 物件的陣列指標,指定 Bézier 曲線的開始、結束和控制點。 一個貝塞爾曲線的結束座標是下一個貝塞爾曲線的開始座標。

[in] count

類型:INT

整數,指定陣列中 點數

傳回值

類型:狀態

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

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

言論

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

例子

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


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

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

   Point startPoint(100, 100);
   Point ctrlPoint1(200, 50);
   Point ctrlPoint2(400, 10);
   Point endPoint1(500, 100);
   Point ctrlPoint3(600, 200);
   Point ctrlPoint4(700, 400);
   Point endPoint2(500, 500);

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

要求

要求 價值
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限傳統型應用程式]
支援的最低伺服器 Windows 2000 Server [僅限傳統型應用程式]
目標平臺 窗戶
標頭 gdiplusgraphics.h (包括 Gdiplus.h)
連結庫 Gdiplus.lib
DLL Gdiplus.dll

另請參閱

貝塞爾曲線

DrawBezier 方法

DrawBeziers

繪製貝氏曲線

圖形

手寫筆