Help Center

GdipAddPathLinefunction

Adds a line to the current figure of this path.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipAddPathLine (BYVAL path AS GpPath PTR, BYVAL x1 AS REAL, BYVAL y1 AS REAL, BYVAL x2 AS REAL, BYVAL y2 AS REAL) AS GpStatus
Also documented as GdipAddPathLineI — one description covers them all.

Parameters

NameDescription
path[in] Pointer to the GraphicsPath object.
x1[in] The x-coordinate of the starting point of the line.
y1[in] The y-coordinate of the starting point of the line.
x2[in] The x-coordinate of the ending point of the line.
y2[in] The y-coordinate of the ending point of the line.

Description

Adds a line to the current figure of the path.

Example

' ======================================================================================== ' This example draws a single line using GdipAddPathLine. ' ======================================================================================== SUB Example_DrawLine (BYVAL hdc AS HDC)

DIM hStatus AS LONG

' // Create a graphics object from the device context DIM graphics AS GpGraphics PTR hStatus = GdipCreateFromHDC(hdc, @graphics)

' // Get the DPI scaling ratios DIM dpiX AS SINGLE hStatus = GdipGetDpiX(graphics, @dpiX) DIM rxRatio AS SINGLE = dpiX / 96 DIM dpiY AS SINGLE hStatus = GdipGetDpiY(graphics, @dpiY) Dim ryRatio AS SINGLE = dpiY / 96 ' // Set the scale transform hStatus = GdipScaleWorldTransform(graphics, rxRatio, ryRatio, MatrixOrderPrepend)

' // Create a GraphicsPath object and initializes the fill mode. DIM path AS GpPath PTR hStatus = GdipCreatePath(FillModeAlternate, @path)

' // Add a line from (50, 50) to (250, 150) hStatus = GdipAddPathLine(path, 50, 50, 250, 150)

' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_BLACK, 2, UnitWorld, @pen)

' // Draw path hStatus = GdipDrawPath(graphics, pen, path)

' // Cleanup IF pen THEN GdipDeleteBrush(pen) IF path THEN GdipDeletePath(path) IF graphics THEN GdipDeleteGraphics(graphics)

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

Reference

  • Defined in AfxNova/AfxGdiPlus.bi:2004
  • Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
  • Topic: GraphicsPath Functions