Function Reference


Sets the pen alignment

#include <GDIPlus.au3>
_GDIPlus_PenSetAlignment ( $hPen [, $iAlignment = 0] )


$hPen Handle to a pen object
$iAlignment [optional] Pen alignment. Can be one of the following:
    0 - Specifies that the pen is aligned on the center of the line that is drawn
    1 - Specifies, when drawing a polygon, that the pen is aligned on the inside of the edge of the polygon

Return Value

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



See Also

Search GdipSetPenMode in MSDN Library.


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


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

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

    ; Create resources
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hPen = _GDIPlus_PenCreate(0xFF000000, 4)
    _GDIPlus_PenSetAlignment($hPen, 1)

    ; Show pen alignment
    MsgBox($MB_SYSTEMMODAL, "Information", "Pen alignment: " & _GDIPlus_PenGetAlignment($hPen))

    ; Draw arrows
    _GDIPlus_GraphicsDrawLine($hGraphic, 10, 130, 390, 130, $hPen)
    _GDIPlus_PenSetWidth($hPen, 6)
    _GDIPlus_GraphicsDrawLine($hGraphic, 10, 150, 390, 150, $hPen)
    _GDIPlus_PenSetWidth($hPen, 8)
    _GDIPlus_GraphicsDrawLine($hGraphic, 10, 170, 390, 170, $hPen)

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

    ; Clean up resources
EndFunc   ;==>Example