GraphicsPath::AddLine method

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

Syntax

Status AddLine(
  IN const PointF & pt1,
  IN 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

   
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