GdipGetPenDashStylefunction
Gets the dash style currently set for a **Pen** object.
Syntax
FUNCTION GdipGetPenDashStyle (BYVAL pen AS GpPen PTR, BYVAL dashstyle AS GpDashStyle PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
pen | [in] Pointer to the Pen object. | |
dashstyle | [out] Pointer to a variable that receives the number of elements in the dash pattern array. |
Description
Gets the number of elements in a dash pattern array.
Example
' ======================================================================================== ' This example sets a dash style for a Pen object, draws a line, and then retrieves the ' dash style using GdipGetPenDashStyle to verify the setting. ' ======================================================================================== SUB Example_GetPenDashStyle (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 a Pen object and set a dash style DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_BLUE, 10, UnitWorld, @pen) hStatus = GdipSetPenDashStyle(pen, DashStyleDot)
' // Draw a dashed line hStatus = GdipDrawLine(graphics, pen, 20, 50, 380, 50)
' // Retrieve the dash style DIM dashStyle AS GpDashStyle hStatus = GdipGetPenDashStyle(pen, @dashStyle) AfxMsg "Dash style: " & WSTR(dashStyle)
' // Cleanup IF pen THEN GdipDeletePen(pen) IF graphics THEN GdipDeleteGraphics(graphics)
END SUB ' ========================================================================================
Reference
- Defined in AfxNova/AfxGdiPlus.bi:2337
- Documented in Graphics/GdiPlus Flat Api/GdiPlusPen.md
- Topic: GdiPlusPen