Graphics::D rawBezier (constPen*,INT,INT,INT,INT,INT,INT,INT,INT,INT) 方法 (gdiplusgraphics.h)
Graphics::D rawBezier 方法绘制贝塞尔样条。
语法
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
);
parameters
[in] pen
类型: const 触控笔*
指向用于绘制贝塞尔样条的笔的指针。
[in] x1
类型: INT
指定贝塞尔样条起点的 x 坐标的整数。
[in] y1
类型: INT
指定贝塞尔样条曲线起点的 y 坐标的整数。
[in] x2
类型: INT
指定贝塞尔样条第一个控制点的 x 坐标的整数。
[in] y2
类型: INT
指定贝塞尔样条曲线第一个控制点的 y 坐标的整数
[in] x3
类型: INT
指定贝塞尔样条第二个控制点的 x 坐标的整数。
[in] y3
类型: INT
指定贝塞尔样条第二个控制点的 y 坐标的整数。
[in] x4
类型: INT
指定贝塞尔样条曲线终点的 x 坐标的整数。
[in] y4
类型: INT
指定贝塞尔样条曲线终点的 y 坐标的整数
返回值
类型: 状态
如果方法成功,则返回 Ok,这是 Status 枚举的元素。
如果 方法失败,它将返回 Status 枚举的其他元素之一。
注解
贝塞尔样条不通过其控制点。 控制点充当磁体,向特定方向拉动曲线,以影响贝塞尔样条的弯曲方式。
示例
以下示例绘制贝塞尔曲线。
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) |
Library | Gdiplus.lib |
DLL | Gdiplus.dll |
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈