CGpGraphicsPath.AddRectanglemethod
Adds a rectangle to this path.
Syntax
FUNCTION AddRectangle (BYVAL x AS SINGLE, BYVAL y AS SINGLE, BYVAL nWidth AS SINGLE, BYVAL nHeight AS SINGLE) AS GpStatus
FUNCTION AddRectangle (BYVAL x AS INT_, BYVAL y AS INT_, BYVAL nWidth AS INT_, BYVAL nHeight AS INT_) AS GpStatus
FUNCTION AddRectangle (BYVAL rc AS GpRectF PTR) AS GpStatus
FUNCTION AddRectangle (BYVAL rc AS GpRect PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
x | The x-coordinate of the upper-left corner of the rectangle. | |
y | The y-coordinate of the upper-left corner of the rectangle. | |
nWidth | The width of the rectangle. | |
nWidth | The height of the rectangle. |
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
Adds a rectangle to this path.
Example
' ======================================================================================== ' The following example creates a GraphicsPath object path, adds a rectangle to path, and then draws path. ' ======================================================================================== SUB Example_AddRectangle (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
DIM rc AS GpRect = (20, 20, 100, 50) DIM path AS CGpGraphicsPath path.AddRectangle(@rc)
' // Draw the path DIM pen AS CGpPen = ARGB_RED graphics.DrawPath(@pen, @path)
END SUB ' ========================================================================================
Reference
- Include file
CGpPath.inc - Defined in AfxNova/CGpPath.inc:344
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class