# Function Reference

# _GDIPlus_PenSetCustomEndCap

Sets the custom end cap for the pen

#include <GDIPlus.au3>
_GDIPlus_PenSetCustomEndCap ( $hPen, $hEndCap )

## Parameters

$hPen | Handle to a pen object
$hEndCap | Handle to a CustomLineCap object that specifies the pen custom end cap

## Return Value

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

## Related

_GDIPlus_PenGetCustomEndCap

## See Also

Search GdipSetPenCustomEndCap in MSDN Library.

## Example

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

    Example()

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

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

        ; Create resources
        _GDIPlus_Startup()
        $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
        $hPen = _GDIPlus_PenCreate(0xFF000000, 4)
        $hEndCap = _GDIPlus_ArrowCapCreate(3, 6)
        _GDIPlus_PenSetCustomEndCap($hPen, $hEndCap)

        ; Show pen end cap
        MsgBox($MB_SYSTEMMODAL, "Information", "Pen end cap: " & _GDIPlus_PenGetCustomEndCap($hPen))

        ; Draw arrows
        _GDIPlus_GraphicsDrawLine($hGraphic, 10, 120, 390, 120, $hPen)
        _GDIPlus_PenSetWidth($hPen, 6)
        _GDIPlus_GraphicsDrawLine($hGraphic, 10, 150, 390, 150, $hPen)
        _GDIPlus_PenSetWidth($hPen, 8)
        _GDIPlus_GraphicsDrawLine($hGraphic, 10, 200, 390, 200, $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