Help Center

GdipAddPathRectanglesfunction

Adds a sequence of rectangles to this path.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipAddPathRectangles (BYVAL path AS GpPath PTR, BYVAL rects AS GpRectF PTR, BYVAL count AS INT_) AS GpStatus
Also documented as GdipAddPathRectanglesI — one description covers them all.

Parameters

NameDescription
path[in] Pointer to the GraphicsPath object.
rects[in] Pointer to an array of rectangles that will be added to the path.
count[in] Long integer value that specifies the number of elements in the rects array.

Description

Adds a sequence of rectangles to the path.

Example

' ======================================================================================== ' This example adds a sequence of rectangles to a GraphicsPath using GdipAddPathRectangles. ' ======================================================================================== SUB Example_DrawRectangles (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 GraphicsPath DIM path AS GpPath PTR hStatus = GdipCreatePath(FillModeAlternate, @path)

' // Define array of rectangles DIM rects(0 TO 2) AS GpRectF rects(0).x = 50 : rects(0).y = 60 : rects(0).Width = 80 : rects(0).Height = 40 rects(1).x = 150 : rects(1).y = 60 : rects(1).Width = 80 : rects(1).Height = 40 rects(2).x = 250 : rects(2).y = 60 : rects(2).Width = 80 : rects(2).Height = 40

' // Add rectangles to path hStatus = GdipAddPathRectangles(path, @rects(0), 3)

' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_INDIGO, 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:2018
  • Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
  • Topic: GraphicsPath Functions