Graphics::D rawBeziers (constPen*,constPoint*,INT) 方法 (gdiplusgraphics.h)
Graphics::D rawBeziers方法會繪製連接 Bézier 曲線的序列。
語法
Status DrawBeziers(
[in] const Pen *pen,
[in] const Point *points,
[in] INT count
);
參數
[in] pen
類型:const Pen*
用來繪製 Bézier 曲線的手寫筆指標。
[in] points
類型:const Point*
Point物件的陣列指標,指定 Bézier 曲線的開始、結束和控制點。 一個 Bézier 曲線的結束座標是下一個 Bézier 曲線的開始座標。
[in] count
類型: INT
整數,指定 點 陣列中的專案數目。
傳回值
類型: 狀態
如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。
如果方法失敗,它會傳回 Status 列舉的其中一個其他元素。
備註
Bézier 曲線不會通過其控制點。 控制點會做為磁力,以特定方向提取曲線,以影響 Bézier 曲線彎曲的方式。
範例
下列範例會繪製一對 Bézier 曲線。
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 [僅限傳統型應用程式] |
目標平台 | Windows |
標頭 | gdiplusgraphics.h (包含 Gdiplus.h) |
程式庫 | Gdiplus.lib |
Dll | Gdiplus.dll |
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應