Graphics::D rawBezier (constPen*,INT,INT,INT,INT,INT) 方法 (gdiplusgraphics.h)
Graphics::D rawBezier方法會繪製 Bézier 曲線。
語法
Status DrawBezier(
[in] const Pen *pen,
[in] INT x1,
[in] INT y1,
[in] INT x2,
[in] INT y2,
[in] INT x3,
[in] INT y3,
[in] INT x4,
[in] INT y4
);
參數
[in] pen
類型:const Pen*
用來繪製貝茲曲線的畫筆指標。
[in] x1
類型: INT
整數,指定 Bézier 曲線起點的 X 座標。
[in] y1
類型: INT
整數,指定 Bézier 曲線起點的 Y 座標。
[in] x2
類型: INT
整數,指定 Bézier 曲線第一個控制點的 X 座標。
[in] y2
類型: INT
整數,指定 Bézier 曲線第一個控制點的 Y 座標
[in] x3
類型: INT
整數,指定 Bézier 曲線第二個控制點的 X 座標。
[in] y3
類型: INT
整數,指定 Bézier 曲線之第二個控制點的 Y 座標。
[in] x4
類型: INT
整數,指定 Bézier 曲線結束點的 X 座標。
[in] y4
類型: INT
整數,指定 Bézier 曲線結束點的 Y 座標
傳回值
類型: 狀態
如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。
如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。
備註
Bézier 曲線不會通過其控制點。 控制點會作為磁力,以特定方向提取曲線,以影響 Bézier 曲線彎曲的方式。
範例
下列範例會繪製 Bézier 曲線。
VOID Example_DrawBezier3(HDC hdc)
{
Graphics graphics(hdc);
// Set up the pen and curve points.
Pen greenPen(Color(255, 0, 255, 0));
int startPointx = 100;
int startPointy = 100;
int ctrlPoint1x = 200;
int ctrlPoint1y = 10;
int ctrlPoint2x = 350;
int ctrlPoint2y = 50;
int endPointx = 500;
int endPointy = 100;
//Draw the curve.
graphics.DrawBezier(
&greenPen,
startPointx,
startPointy,
ctrlPoint1x,
ctrlPoint1y,
ctrlPoint2x,
ctrlPoint2y,
endPointx,
endPointy);
//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 |
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應