CGpGraphicsPath.Widenmethod
Replaces this path with curves that enclose the area that is filled when this path is drawn by a specified pen.
Syntax
FUNCTION Widen (BYVAL pPen AS CGpPen PTR, BYVAL pMatrix AS CGpMatrix PTR = NULL, BYVAL flatness AS SINGLE = FlatnessDefault) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
pPen | Pointer to a Pen object. The path is made as wide as it would be when drawn by this pen. | |
pMatrix | Optional. Pointer to a Matrix object that specifies a transformation to be applied along with the widening. If this parameter is NULL, no transformation is applied. The default value is NULL. | |
flatness | Optional. Real number that influences the number of line segments that are used to approximate the original path. Small values specify that many line segments are used, and large values specify that few line segments are used. The default value is FlatnessDefault, which is a constant defined in Gdiplusenums.bi. |
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
Replaces this path with curves that enclose the area that is filled when this path is drawn by a specified pen. The Widen method also flattens the path.
Example
' ======================================================================================== ' The following example creates a GraphicsPath object and adds a closed curve to the path. ' The code creates a green pen that has a width of 10 and passes the address of that pen ' to the GraphicsPath.Widen method. Then the code draws the path with a blue pen of width 1. ' ======================================================================================== SUB Example_Widen (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 bluePen AS CGpPen = ARGB_BLUE DIM greenPen AS CGpPen = CGpPen(ARGB_LIGHTGREEN, 10) DIM points(0 TO 3) AS GpPoint = {(20, 20), (160, 100), (140, 60), (60, 100)}
DIM path AS CGpGraphicsPath path.AddClosedCurve(@points(0), 4) path.Widen(@greenPen) graphics.DrawPath(@bluePen, @path)
END SUB ' ========================================================================================
Reference
- Include file
CGpPath.inc - Defined in AfxNova/CGpPath.inc:514
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class