Function Reference


Creates a HatchBrush object based on a hatch style, a foreground color, and a background color

#include <GDIPlus.au3>
_GDIPlus_HatchBrushCreate ( [$iHatchStyle = 0 [, $iARGBForeground = 0xFFFFFFFF [, $iARGBBackground = 0xFFFFFFFF]]] )


$iHatchStyle [optional] Pattern of hatch lines that will be used, see remarks. Default = $GDIP_HATCHSTYLE_HORIZONTAL (0).
$iARGBForeground [optional] Alpha, Red, Green and Blue components of the hatch lines
$iARGBBackground [optional] Alpha, Red, Green and Blue components of the hatch background

Return Value

Success: a pointer to a new HatchBrush object.
Failure: 0 and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3).


The pattern constants are declared in GDIPlusConstants.au3, those that start with $GDIP_HATCHSTYLE_*.
When you are done with the HatchBrush object, call _GDIPlus_BrushDispose() to release the resources.



See Also

Search GdipCreateHatchBrush in MSDN Library.


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


Func Example()
        Local $hBrush, $iX, $iY

        ; Create GUI
        Local $hGUI = GUICreate("GDI+", 810, 610)

        Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle

        For $i = 0 To 52
                $iX = 10 + Mod($i, 10) * 80
                $iY = 30 + Floor($i / 10) * 100
                _GDIPlus_GraphicsDrawString($hGraphic, $i, $iX, $iY - 16)

                $hBrush = _GDIPlus_HatchBrushCreate($i, 0xFF00FF00, 0xFF0000FF)
                _GDIPlus_GraphicsFillRect($hGraphic, $iX, $iY, 70, 70, $hBrush)


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

        ; Clean up resources
EndFunc   ;==>Example