Graphics::DrawLines(constPen*,constPoint*,INT) method (gdiplusgraphics.h)

The Graphics::DrawLines method draws a sequence of connected lines.

Syntax

Status DrawLines(
  [in] const Pen   *pen,
  [in] const Point *points,
  [in] INT         count
);

Parameters

[in] pen

Type: const Pen*

Pointer to a pen that is used to draw the lines.

[in] points

Type: const Point*

Pointer to an array of Point objects that specify the starting and ending points of the lines.

[in] count

Type: INT

Integer that specifies the number of elements in the points array.

Return value

Type: Status

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

Each line requires a starting point and an ending point. The ending point of each line is the starting point for the next.

Examples

The following example draws a sequence of connected lines.


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

   // Create a Pen object.
   Pen blackPen(Color(255, 0, 0, 0), 3);

   // Create an array of Point objects that define the lines to draw.
   Point point1(10, 10);
   Point point2(10, 100);
   Point point3(200, 50);
   Point point4(250, 300);

   Point points[4] = {point1, point2, point3, point4};
   Point* pPoints = points;

   // Draw the lines.
   graphics.DrawLines(&blackPen, pPoints, 4);
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusgraphics.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

DrawLine Methods

Graphics

Pens, Lines, and Rectangles

Point

Using a Pen to Draw Lines and Rectangles