Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
Global $tab_graph0[5][3]=[[141,0-10,20],[32,11-15,10],[20,16-20,50],[10,21-25,42],[32,26-30,12]]
Global $tab_graph1[5][3]=[[12,0-10,1],[5,11-15,50],[13,16-20,27],[49,21-25,57],[455,26-30,12]]
Func graphique($HB,$EB,$LG,$tab,$x,$y)
If IsDeclared("Graphic7") Then
GUICtrlDelete($Graphic7)
GUICtrlDelete($Graphic8)
GUICtrlDelete($Graphic7)
GUICtrlDelete($Graphic8)
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If _ArrayMax($tab, 1, 0, 0, 0)>_ArrayMax($tab, 1, 0, 0, 2) Then
$valeur_de_base=_ArrayMax($tab, 1, 0, 0, 0)
ElseIf _ArrayMax($tab, 1, 0, 0, 0)=_ArrayMax($tab, 1, 0, 0, 2) Then
$valeur_de_base=_ArrayMax($tab, 1, 0, 0, 2)
Else
$valeur_de_base=_ArrayMax($tab, 1, 0, 0, 0)
EndIf
Global $graph[5][3]
For $a=0 To UBound($tab)-1
$graph[$a][0]=Round($tab[$a][0]*$LG/$valeur_de_base)
$graph[$a][1]=$tab[$a][1]
$graph[$a][2]=Round($tab[$a][2]*$LG/$valeur_de_base)
Next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
For $b=0 To 1
$HG=($HB+$EB)*UBound($graph)+$EB
Global $GraphicG = GUICtrlCreateGraphic($x, $y, $LG, $HG)
GUICtrlSetColor(-1, 0x008000)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xFF0000)
For $a=0 To UBound($graph)-1
GUICtrlSetGraphic(-1, $GUI_GR_RECT, $LG-$graph[$a][0], 0+($HB*$a)+$EB*($a+1), $graph[$a][0], $HB)
Next
Global $GraphicD = GUICtrlCreateGraphic($x+$LG-1, $y, $LG, $HG)
GUICtrlSetColor(-1, 0x008000)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xFF0000)
For $a=0 To UBound($graph)-1
GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0+($HB*$a)+$EB*($a+1), $graph[$a][2], $HB)
Next
Next
EndFunc
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 516, 438, 192, 124)
$Boutton0 = GUICtrlCreateButton("premier graph","2","350")
$Boutton1 = GUICtrlCreateButton("second graph","100","350")
$Boutton2 = GUICtrlCreateButton("del","2","350")
GUICtrlSetState($Boutton2,$GUI_HIDE)
$Boutton3 = GUICtrlCreateButton("del","100","350")
GUICtrlSetState($Boutton3,$GUI_HIDE)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Boutton0
graphique(10,2,200,$tab_graph0,20,20)
GUICtrlSetState($Boutton0,$GUI_HIDE)
GUICtrlSetState($Boutton2,$GUI_SHOW)
Case $Boutton1
graphique(10,20,100,$tab_graph1,120,120)
GUICtrlSetState($Boutton1,$GUI_HIDE)
GUICtrlSetState($Boutton3,$GUI_SHOW)
Case $Boutton2
GUICtrlDelete($GraphicG)
GUICtrlDelete($GraphicD)
Case $Boutton3
GUICtrlDelete($GraphicG)
GUICtrlDelete($GraphicD)
EndSwitch
WEnd