Help Center

CGpGraphics.DrawPolygonmethod

Draws a polygon.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION DrawPolygon (BYVAL pPen AS CGpPen PTR, BYVAL pts AS GpPointF PTR, BYVAL count AS LONG) AS GpStatus
FUNCTION DrawPolygon (BYVAL pPen AS CGpPen PTR, BYVAL pts AS GpPoint PTR, BYVAL count AS LONG) AS GpStatus

Parameters

NameDescription
pPenPointer to a pen that is used to draw the polygon.
ptsPointer to an array of GpPointF objects that specify the vertices of the polygon.
nCountInteger that specifies the number of elements in the points array.

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 polygon.

Example

' ======================================================================================== ' The following example draws a sequence of connected lines. ' ======================================================================================== SUB Example_DrawPolygon (BYVAL hdc AS HDC)

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

' // Create a Pen object DIM blackPen AS CGpPen = CGpPen(ARGB_BLACK, 3)

' // Create an array of GpPoint objects that define the lines to draw DIM point1 AS GpPoint = (100, 100) DIM point2 AS GpPoint = (200, 130) DIM point3 AS GpPoint = (150, 200) DIM point4 AS GpPoint = (50, 200) DIM point5 AS GpPoint = (0, 130) DIM pts(0 TO 4) AS GpPoint = {point1, point2, point3, point4, point5}

' // Draw the polygon graphics.DrawPolygon(@blackPen, @pts(0), 5)

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

Reference

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