Help Center

CGpGraphics.DrawLinemethod

Draws a line that connects two points.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION DrawLine (BYVAL pPen AS CGpPen PTR, BYVAL x1 AS SINGLE, BYVAL y1 AS SINGLE, BYVAL x2 AS SINGLE, BYVAL y2 AS SINGLE) AS GpStatus
FUNCTION DrawLine (BYVAL pPen AS CGpPen PTR, BYVAL pt1 AS GpPointF PTR, BYVAL pt2 AS GpPointF PTR) AS GpStatus
FUNCTION DrawLine (BYVAL pPen AS CGpPen PTR, BYVAL pt1 AS GpPoint PTR, BYVAL pt2 AS GpPoint PTR) AS GpStatus

Parameters

NameDescription
pPenPointer to a pen that is used to draw the line.
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

Draws a line that connects two points.

Example

' ======================================================================================== ' The following example draws a line. ' ======================================================================================== SUB Example_DrawLine (BYVAL hdc AS HDC)

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

' // Draw the line DIM blackPen AS CGpPen = CGpPen(ARGB_BLACK, 3) graphics.DrawLine(@blackPen, 50.0, 100.0, 350.0, 100.0)

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

Reference

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