Graphics::DrawCurve(constPen*,constPointF*,INT) method (gdiplusgraphics.h)
The Graphics::DrawCurve method draws a cardinal spline.
Syntax
Status DrawCurve(
const Pen *pen,
const PointF *points,
INT count
);
Parameters
pen
Pointer to a pen used to draw the cardinal spline.
points
Pointer to an array of PointF objects that specify the coordinates that the cardinal spline passes through.
count
Integer that specifies the number of elements in the points array.
Return value
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Remarks
A segment is defined as a curve that connects two consecutive points in the cardinal spline. The ending point of each segment is the starting point for the next.
Examples
The following example draws a cardinal spline.
VOID Example_DrawCurve4(HDC hdc)
{
Graphics graphics(hdc);
// Define a Pen object and an array of Point objects.
Pen greenPen(Color::Green, 3);
PointF point1(100.0f, 100.0f);
PointF point2(200.0f, 50.0f);
PointF point3(400.0f, 10.0f);
PointF point4(500.0f, 100.0f);
PointF curvePoints[4] = {
point1,
point2,
point3,
point4};
PointF* pcurvePoints = curvePoints;
// Draw the curve.
graphics.DrawCurve(&greenPen, curvePoints, 4);
//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));
}
Requirements
Requirement | Value |
---|---|
Header | gdiplusgraphics.h |