#include <GUIConstantsEx.au3>
Global $Ant[2]
$Ant[0] = 50
$Ant[1] = 50
Global $base[2]
$base[0] = $Ant[0]
$base[1] = $Ant[1]
$GUI = GUICreate("Form1",500,500,100,100)
Global $check[2]
$check[0] = GUICtrlCreateCheckbox("division 1",85,10,70,25)
$check[1] = GUICtrlCreateCheckbox("division 2",85,55,70,25)
$button1 = GUICtrlCreateButton("Baisse 1",10,10,70,40)
$button2 = GUICtrlCreateButton("Baisse 2",10,55,70,40)
Global $Label[2]
$Label[0] = GUICtrlCreateLabel("Base 1 : " & $base[0] & @CRLF & "Après baisse : " & $Ant[0],170,10,85,25)
$Label[1] = GUICtrlCreateLabel("Base 2 : " & $base[1] & @CRLF & "Après baisse : " & $Ant[1],170,55,85,25)
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $button1
_Baisse($check,$ant,$Label,$base,0)
Case $button2
_Baisse($check,$ant,$Label,$base,1)
EndSwitch
WEnd
Func _IsChecked($control)
Return BitAND(GUICtrlRead($control),$GUI_CHECKED)=$GUI_CHECKED
EndFunc
Func _Baisse($check,$ant,$Label,$base,$i)
If _IsChecked($check[$i]) Then
$ant[$i] = $ant[$i]-Random(1,5,1)
Else
$ant[$i] = $ant[$i]-Random(6,10,1)
EndIf
GUICtrlSetData($Label[$i],"Base " & $i+1 & " : " & $base[$i] & @CRLF & "Après baisse : " & $Ant[$i])
EndFunc
Global $Ant[2]
$Ant[0] = 50
$Ant[1] = 50
Global $base[2]
$base[0] = $Ant[0]
$base[1] = $Ant[1]
$GUI = GUICreate("Form1",500,500,100,100)
Global $check[2]
$check[0] = GUICtrlCreateCheckbox("division 1",85,10,70,25)
$check[1] = GUICtrlCreateCheckbox("division 2",85,55,70,25)
$button1 = GUICtrlCreateButton("Baisse 1",10,10,70,40)
$button2 = GUICtrlCreateButton("Baisse 2",10,55,70,40)
Global $Label[2]
$Label[0] = GUICtrlCreateLabel("Base 1 : " & $base[0] & @CRLF & "Après baisse : " & $Ant[0],170,10,85,25)
$Label[1] = GUICtrlCreateLabel("Base 2 : " & $base[1] & @CRLF & "Après baisse : " & $Ant[1],170,55,85,25)
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $button1
_Baisse($check,$ant,$Label,$base,0)
Case $button2
_Baisse($check,$ant,$Label,$base,1)
EndSwitch
WEnd
Func _IsChecked($control)
Return BitAND(GUICtrlRead($control),$GUI_CHECKED)=$GUI_CHECKED
EndFunc
Func _Baisse($check,$ant,$Label,$base,$i)
If _IsChecked($check[$i]) Then
$ant[$i] = $ant[$i]-Random(1,5,1)
Else
$ant[$i] = $ant[$i]-Random(6,10,1)
EndIf
GUICtrlSetData($Label[$i],"Base " & $i+1 & " : " & $base[$i] & @CRLF & "Après baisse : " & $Ant[$i])
EndFunc