Help Center

CGpGraphicsPath.AddLinemethod

Adds a line to the current figure of this path.

GraphicsmethodCGpPath.incdocumented

Syntax

FUNCTION AddLine (BYVAL x1 AS SINGLE, BYVAL y1 AS SINGLE, BYVAL x2 AS SINGLE, BYVAL y2 AS SINGLE) AS GpStatus
FUNCTION AddLine (BYVAL x1 AS INT_, BYVAL y1 AS INT_, BYVAL x2 AS INT_, BYVAL y2 AS INT_) AS GpStatus
FUNCTION AddLine (BYVAL pt1 AS GpPointF PTR, BYVAL pt2 AS GpPointF PTR) AS GpStatus
FUNCTION AddLine (BYVAL pt1 AS GpPoint PTR, BYVAL pt2 AS GpPoint PTR) AS GpStatus

Parameters

NameDescription
x1The x-coordinate of the starting point of the line.
y1The y-coordinate of the starting point of the line.
x2The x-coordinate of the ending point of the line.
y2The y-coordinate of the ending point of the line.

Return value

If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.

If the function fails, it returns one of the other elements of the GpStatus enumeration.

Description

Adds a line to the current figure of this path.

Example

' ======================================================================================== ' The following example creates a GraphicsPath object path, adds a line to path, and then draws path. ' ======================================================================================== SUB Example_AddLine (BYVAL hdc AS HDC)

' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi

DIM path AS CGpGraphicsPath path.AddLine(20, 20, 200, 100)

' // Draw the path DIM pen AS CGpPen = CGpPen(ARGB_RED, 3) graphics.DrawPath(@pen, @path)

END SUB ' ========================================================================================

Reference

  • Include file CGpPath.inc
  • Defined in AfxNova/CGpPath.inc:169
  • Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
  • Topic: CGpGraphics Class