Help Center

CGpGraphics.DrawRectanglemethod

Draws a rectangle.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION DrawRectangle (BYVAL pPen AS CGpPen PTR, BYVAL x AS SINGLE, BYVAL y AS SINGLE, BYVAL nWidth AS SINGLE, BYVAL nHeight AS SINGLE) AS GpStatus
FUNCTION DrawRectangle (BYVAL pPen AS CGpPen PTR, BYVAL x AS INT_, BYVAL y AS INT_, BYVAL nWidth AS INT_, BYVAL nHeight AS INT_) AS GpStatus
FUNCTION DrawRectangle (BYVAL pPen AS CGpPen PTR, BYVAL rc AS GpRectF PTR) AS GpStatus
FUNCTION DrawRectangle (BYVAL pPen AS CGpPen PTR, BYVAL rc AS GpRect PTR) AS GpStatus

Parameters

NameDescription
pPenPointer to a pen that is used to draw the rectangle.
xThe x-coordinate of the upper-left corner of the rectangle.
yThe y-coordinate of the upper-left corner of the rectangle.
nWidthThe width of the rectangle.
nHeightThe height of the rectangle.
rcThe x, y, width and height of the rectangle as a GpRect or GpRectF structure.

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

Example

' ======================================================================================== ' The following example draws a rectangle. ' ======================================================================================== SUB Example_DrawRectangle (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 rectangle DIM blackPen AS CGpPen = CGpPen(ARGB_BLACK, 3) graphics.DrawRectangle(@blackPen, 0, 0, 200, 200)

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

Reference

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