Restaure l'�tat d'un objet Graphics � l'�tat m�moris� par un appel pr�c�dent � la m�thode _GDIPlus_GraphicsSave de l'objet Graphics
#include <GDIPlus.au3>
_GDIPlus_GraphicsRestore ( $hGraphics, $iState )
$hGraphics | Handle de l'objet Graphics |
$iState | Valeur identifiant le bloc de l'Etat sauvegard� pr�c�demment retourn� par la m�thode _GDIPlus_GraphicsSave(). |
Succ�s: | Retourne True. |
�chec: | Retourne False et d�finit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
Consultez GdipRestoreGraphics dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hFormat, $hFamily, $tLayout, $fSize, $iGfx_Save $iW = 800 $iH = 300 $hGUI = GUICreate("GDI+", $iW, $iH) GUISetState(@SW_SHOW) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hPath = _GDIPlus_PathCreate(1) For $i = 1 To 200 $fSize = Random(10, 30) _GDIPlus_PathAddEllipse($hPath, Random(0, $iW), Random(0, $iH), $fSize, $fSize) Next _GDIPlus_GraphicsSetClipPath($hGraphic, $hPath); D�finir la r�gion � d�coupage $iGfx_Save = _GDIPlus_GraphicsSave($hGraphic); Sauvegarde la r�gion de d�coupage _GDIPlus_PathReset($hPath) $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) $hFamily = _GDIPlus_FontFamilyCreate("Arial Black") $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) _GDIPlus_PathAddString($hPath, "AutoIt", $tLayout, $hFamily, 1, 200, $hFormat) _GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 3); Met � jour la r�gion de d�coupage $hBrush = _GDIPlus_BrushCreateSolid(0xFF7F00FF) _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) _GDIPlus_GraphicsRestore($hGraphic, $iGfx_Save); Restaure la zone de d�coupage $hPen = _GDIPlus_PenCreate(0xFFFF007F) _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ; Boucle jusqu'� ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_PathDispose($hPath) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example