GraphicsPath::AddCurve (constPoint*,INT,REAL) 方法 (gdipluspath.h)

GraphicsPath::AddCurve 方法将基数样条添加到此路径的当前图形中。

语法

Status AddCurve(
  [in] const Point *points,
  [in] INT         count,
  [in] REAL        tension
);

参数

[in] points

类型: const Point*

指向定义基数样条的点数组的指针。 基数样条是一条穿过数组中每个点的曲线。

[in] count

类型: INT

指定 数组中的元素数的整数。

[in] tension

类型: REAL

控制曲线长度和曲线弯曲方式的非否定实数。 值为 0 指定样条是直线段的序列。 随着值的增加,曲线变得更加完整。

返回值

类型: 状态

如果该方法成功,则返回 Ok,这是 Status 枚举的元素。

如果方法失败,它将返回 Status 枚举的其他元素之一。

注解

如果以后需要 这些点 ,则应保留点数组的副本。 GraphicsPath 对象不存储传递给 AddClosedCurve 方法的点;相反,它将基数样条转换为贝塞尔样条序列,并存储定义这些贝塞尔样条的点。 无法从 GraphicsPath 对象中检索原始的点数组。

示例

以下示例创建 一个 GraphicsPath 对象,并调用 GraphicsPath::AddCurve 方法将基数样条添加到路径。 传递给 GraphicsPath::AddCurve 的第三个参数指定基数样条的拉伸。

VOID AddCurveExample(HDC hdc)
{
   Graphics graphics(hdc);
   Point pts[] = {Point(50, 50),
                  Point(60, 20),
                  Point(70, 100),
                  Point(80, 50)};
   GraphicsPath path;
   path.AddCurve(pts, 4);
   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);   
}
Color(255, 255, 0,  0)

要求

要求
最低受支持的客户端 Windows XP、Windows 2000 Professional [仅限桌面应用]
最低受支持的服务器 Windows 2000 Server [仅限桌面应用]
目标平台 Windows
标头 gdipluspath.h (包括 Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

另请参阅

AddBezier 方法

AddBeziers 方法

AddClosedCurve 方法

AddCurve 方法

基数样条

使用区域进行剪裁

构造并绘制轨迹

创建路径渐变

绘制基数样条

GraphicsPath

路径

Point