Function Reference


_GDIPlus_PenGetWidth

Retrieve the width of a pen

#include <GDIPlus.au3>
_GDIPlus_PenGetWidth ( $hPen )

Parameters

$hPen Handle to a pen object

Return Value

Success: the width of pen.
Failure: -1 and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPID_ERR*).

Related

_GDIPlus_PenSetWidth

See Also

Search GdipGetPenWidth in MSDN Library.

Example

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $hGUI, $hGraphic, $hPen

    ; Create GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    GUISetState(@SW_SHOW)

    ; Draw line
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hPen = _GDIPlus_PenCreate(0xFF000000, 8)
    _GDIPlus_PenSetWidth($hPen, 4)
    _GDIPlus_GraphicsDrawLine($hGraphic, 10, 10, 390, 10, $hPen)

    ; Show pen width
    MsgBox($MB_SYSTEMMODAL, "Information", "Pen Width: " & _GDIPlus_PenGetWidth($hPen))

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example