Graphics::D rawBeziers (constPen*,constPoint*,INT) 方法 (gdiplusgraphics.h)
Graphics::D rawBeziers 方法绘制一系列连接的贝塞尔样条。
语法
Status DrawBeziers(
[in] const Pen *pen,
[in] const Point *points,
[in] INT count
);
parameters
[in] pen
类型: 常数 笔*
指向用于绘制贝塞尔样条的笔的指针。
[in] points
类型: const Point*
指向 Point 对象数组的指针,该数组指定贝塞尔样条的起始点、结束点和控制点。 一条贝塞尔样条的结束坐标是下一个贝塞尔样条的起始坐标。
[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 [仅限桌面应用] |
目标平台 | Windows |
标头 | gdiplusgraphics.h (包括 Gdiplus.h) |
Library | Gdiplus.lib |
DLL | Gdiplus.dll |
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈