Graphics::D rawCurve (constPen*,constPoint*,INT,INT,INT,INT,REAL) 方法 (gdiplusgraphics.h)

Graphics::D rawCurve 方法绘制基数样条。

语法

Status DrawCurve(
  [in] const Pen   *pen,
  [in] const Point *points,
  [in] INT         count,
  [in] INT         offset,
  [in] INT         numberOfSegments,
  [in] REAL        tension
);

参数

[in] pen

类型: const 触控笔*

指向用于绘制基数样条的笔的指针。

[in] points

类型: const Point*

指向 Point 对象数组的指针,该数组指定基数样条通过的坐标。

[in] count

类型: INT

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

[in] offset

类型: INT

整数,指定 数组中的元素,该元素指定基数样条线开始的点。

[in] numberOfSegments

类型: INT

指定基数样条中的段数的整数。

[in] tension

类型: REAL

实数,指定曲线在基线样条坐标上的弯曲程度。

返回值

类型: 状态

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

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

注解

线段定义为连接基数样条中两个连续点的曲线。 每个段的终点是下一个段的起点。 numberOfSegments 参数不能大于 count 参数减去偏移参数加 1。

示例

以下示例绘制基数样条。

VOID Example_DrawCurve2(HDC hdc)
{
   Graphics graphics(hdc);

   // Define a Pen object and an array of Point objects.
   Pen greenPen(Color::Green, 3);
   Point point1(100, 100);
   Point point2(200, 50);
   Point point3(400, 10);
   Point point4(500, 100);

   Point curvePoints[4] = {
   point1,
   point2,
   point3,
   point4};

   Point* pcurvePoints = curvePoints;

   // Specify offset, number of segments to draw, and tension.
   int offset = 1;
   int segments = 2;
   REAL tension = 1.0;

   // Draw the curve.
   graphics.DrawCurve(&greenPen, curvePoints, 4, offset, segments, tension);

   //Draw the points in the curve.
   SolidBrush redBrush(Color::Red);
   graphics.FillEllipse(&redBrush, Rect(95, 95, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(195, 45, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(395, 5, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(495, 95, 10, 10));
}

要求

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

另请参阅

基数样条

DrawClosedCurve 方法

绘制基数样条

显卡

Point