Function Reference


_GDIPlus_GraphicsSetClipRect

Updates the clipping region of a Graphics object to a region that is the combination of itself and a rectangle

#include <GDIPlus.au3>
_GDIPlus_GraphicsSetClipRect ( $hGraphics, $nX, $nY, $nWidth, $nHeight [, $iCombineMode = 0] )

Parameters

$hGraphics Pointer to a Graphics object
$nX X coordinate of the upper-left corner of the rectangle
$nY Y coordinate of the upper-left corner of the rectangle
$nWidth Width of the rectangle
$nHeight Height of the rectangle
$iCombineMode [optional] Regions combination mode:
    0 - The existing region is replaced by the new region
    1 - The existing region is replaced by the intersection of itself and the new region
    2 - The existing region is replaced by the union of itself and the new region
    3 - The existing region is replaced by the result of performing an XOR on the two regions
    4 - The existing region is replaced by the portion of itself that is outside of the new region
    5 - The existing region is replaced by the portion of the new region that is outside of the existing region

Return Value

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

See Also

Search GdipSetClipRect in MSDN Library.

Example

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

Example()

Func Example()
        Local $hGUI = GUICreate("GDI+", 320, 240)
        GUICtrlCreateButton("Button", 20, 20, 100, 25)
        GUICtrlCreateSlider(100, 100, 100, 30)
        GUISetState(@SW_SHOW)

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

        _GDIPlus_GraphicsSetClipRect($hGraphics, 20, 20, 100, 25, 4) ;subtract button-area from clipregion
        _GDIPlus_GraphicsSetClipRect($hGraphics, 100, 100, 100, 30, 4) ;subtract slider-area from clipregion

        Local $iTimer = TimerInit()
        ; Loop until the user exits.
        Do
                If TimerDiff($iTimer) > 100 Then
                        _GDIPlus_GraphicsClear($hGraphics, BitOR(0xFF000000, Random(0, 0xFFFFFF, 1)))
                        $iTimer = TimerInit()
                EndIf
        Until GUIGetMsg() = $GUI_EVENT_CLOSE

        ; Clean up resources
        _GDIPlus_GraphicsDispose($hGraphics)
        _GDIPlus_Shutdown()
EndFunc   ;==>Example