Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
HttpSetUserAgent("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)")
InetGet("http://www.autoitscript.fr/forum/download/file.php?avatar=3780_1325838591.jpg", @tempdir & "\cat.gif")
$gui = GUICreate(" --- ProgressBar ---", 200, 150)
GUICtrlCreatePic (@tempdir & "\cat.gif", 0, 0, 200, 150)
GUISetState()
$progress1 = _GUICtrlCreateTransparentProgress ( $gui, 10 , 10, 180, 25 , 0xDD0000)
$progress2 = _GUICtrlCreateTransparentProgress ( $gui, 10 , 40, 180, 25 , 0x00DD00)
$progress3 = _GUICtrlCreateTransparentProgress ( $gui, 10 , 70, 180, 25 , 0x0000DD)
For $i = 0 To 100 Step 1
_GUICtrlTransparentProgressSetState($progress1 , $i)
_GUICtrlTransparentProgressSetState($progress2, $i)
_GUICtrlTransparentProgressSetState($progress3, $i)
Sleep(50)
Next
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Func _GUICtrlTransparentProgressSetState($myProgressBar, $percent )
$hGUI = $myProgressBar[0][0]
$x = $myProgressBar[0][1] + 1
$y = $myProgressBar[0][2] + 1
$w = $myProgressBar[0][3] - 1
$h = $myProgressBar[0][4] - 1
$color = 0xFF000000 + $myProgressBar[0][5]
$p = Int($percent * $w / 100)
_GDIPlus_Startup()
$hBrush1 = _GDIPlus_BrushCreateSolid()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND( $hGUI )
_GDIPlus_BrushSetSolidColor($hBrush1, $color)
_GDIPlus_GraphicsFillRect($hGraphic, $x , $y , $p, $h , $hBrush1)
_GDIPlus_BrushSetSolidColor($hBrush1, 0X11000000)
_GDIPlus_GraphicsFillRect($hGraphic, $x , $y + 3 , $p, $h - 4 , $hBrush1)
_GDIPlus_BrushSetSolidColor($hBrush1, 0X11000000)
_GDIPlus_GraphicsFillRect($hGraphic, $x , $y + 6 , $p, $h - 8 , $hBrush1)
EndFunc ; ---> _GUICtrlTransparentProgressSetState()
Func _GUICtrlCreateTransparentProgress( $hGUI, $x, $y, $w, $h , $color = 0x00DD00 )
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hPen = _GDIPlus_PenCreate()
_GDIPlus_PenSetColor($hPen, 0xFF000000)
_GDIPlus_GraphicsDrawLine($hGraphic, $x, $y, $x , $y + $h, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $x, $y + $h, $x + $w, $y + $h, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $x + $w, $y + $h, $x + $w, $y, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $x + $w, $y , $x , $y, $hPen)
Dim $tab[1][6] = [[$hGUI, $x, $y, $w, $h, $color]]
Return $tab
EndFunc ; ---> _GUICtrlCreateTransparentProgress()