GraphicsPath::AddLines method

The GraphicsPath::AddLines method adds a sequence of connected lines to the current figure of this path.


Status AddLines(
  IN const PointF *points,
  IN INT          count



Pointer to an array of points that specify the starting and ending points of the lines. The first point in the array is the starting point of the first line, and the last point in the array is the ending point of the last line. Each of the other points serves as ending point for one line and starting point for the next line.


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.



The following example creates a GraphicsPath object path, adds a sequence of four connected lines to path, and then draws path.

VOID Example_AddLines(HDC hdc)
   Graphics graphics(hdc);

   PointF pts[] = {PointF(20.0f, 20.0f),
                   PointF(30.0f, 30.0f),
                   PointF(40.0f, 25.0f),
                   PointF(50.0f, 30.0f),
                   PointF(60.0f, 20.0f)};

   GraphicsPath path;
   path.AddLines(pts, 5);

   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);


Header gdipluspath.h

See Also

AddLine Methods

AddLines Methods

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient



Pens, Lines, and Rectangles


Using a Pen to Draw Lines and Rectangles