GraphicsPath::AddLine(constPointF&,constPointF&) method (gdipluspath.h)

The GraphicsPath::AddLine method adds a line to the current figure of this path.

Syntax

Status AddLine(
  const PointF & pt1,
  const PointF & pt2
);

Parameters

pt1

Reference to a point at which to start the line.

pt2

Reference to a point at which to end the line.

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

Examples

The following example creates a GraphicsPath object path, adds a line to path, and then draws path.

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

   PointF point1(20.0f, 20.0f);
   PointF point2(100.0f, 100.0f);

   GraphicsPath path;
   path.AddLine(point1, point2);

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

Requirements

Requirement Value
Header gdipluspath.h

See also

AddLine Methods

AddLines Methods

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient

GraphicsPath

Paths

Pens, Lines, and Rectangles

PointF

Using a Pen to Draw Lines and Rectangles