Code : Tout sélectionner
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Dim $Gui
Dim $Pic[4]
Dim $AutoUpdate[4]
Dim $Timer
Dim $VitesseClignotement = 500
$GUI = GUICreate ("test", 130, 130)
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")
$Pic[0] = GUICtrlCreatePic ("close.jpg", 100, 10, 10, 20)
$Pic[1] = GUICtrlCreatePic ("close.jpg", 100, 40, 10, 20)
$Pic[2] = GUICtrlCreatePic ("close.jpg", 100, 70, 10, 20)
$Pic[3] = GUICtrlCreatePic ("close.jpg", 100, 100, 10, 20)
$AutoUpdate[0] = GUICtrlCreateCheckbox("Test1", 10, 10, 90, 17)
$AutoUpdate[1] = GUICtrlCreateCheckbox("Test2", 10, 40, 90, 17)
$AutoUpdate[2] = GUICtrlCreateCheckbox("Test3", 10, 70, 90, 17)
$AutoUpdate[3] = GUICtrlCreateCheckbox("Test4", 10, 100, 90, 17)
AdlibRegister("Clignote", 100)
For $i = 0 To 3
GUICtrlSetOnEvent($AutoUpdate[$i], "StartStopClignote")
Next
GUISetState ()
$Timer = TimerInit()
While(True)
Sleep(10)
Wend
Func _IsChecked($control)
Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc ;==>_IsChecked
Func StartStopClignote()
Local $NumeroCheck = -1
For $i = 0 To 3
If($AutoUpdate[$i] = @GUI_CtrlId) Then
If(Not(IsChecked($AutoUpdate[$i]))) Then
GUICtrlSetImage($Pic[$i], "close.jpg")
EndIf
ExitLoop
EndIf
Next
EndFunc
Func Clignote()
For $i = 0 To 3
If(IsChecked($AutoUpdate[$i])) Then
If(Mod(TimerDiff($Timer), 2*$VitesseClignotement) < $VitesseClignotement) Then
GUICtrlSetImage($Pic[$i], "open.JPG")
Else
GUICtrlSetImage($Pic[$i], "close.JPG")
EndIf
If(TimerDiff($Timer) > 2*$VitesseClignotement) Then
$Timer = TimerInit()
EndIf
EndIf
Next
EndFunc
Func IsChecked($CtrlID)
Local $Retour = False
If(BitAND(GUICtrlRead($CtrlID), $GUI_CHECKED)) Then
$Retour = True
EndIf
Return $Retour
EndFunc
Func quit()
Exit
EndFunc