Help Center

GdipAddPathRectanglefunction

Adds a rectangle to this path.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipAddPathRectangle (BYVAL path AS GpPath PTR, BYVAL x AS REAL, BYVAL y AS REAL, BYVAL width AS REAL, BYVAL height AS REAL) AS GpStatus
Also documented as GdipAddPathRectangleI — one description covers them all.

Parameters

NameDescription
path[in] Pointer to the GraphicsPath object.
x[in] The x-coordinate of the upper-left corner of the bounding rectangle.
y[in] The y-coordinate of the upper-left corner of the bounding rectangle.
width[in] The width of the bounding rectangle.
width[in] The height of the bounding rectangle.

Description

Adds a rectangle to the path.

Example

' ======================================================================================== ' This example draws a rectangle using GdipAddPathRectangle. ' ======================================================================================== SUB Example_DrawRectangle (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)

' // Add rectangle to path hStatus = GdipAddPathRectangle(path, 150, 60, 100, 100)

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