
Je vous sollicite à nouveau pour mon petit programme.
J'ai bien avancé suite à ce sujet , mais je me retrouve face à un souci que je n'arrive pas à comprendre. Je voudrais ajouter un graphique sur un nouvel onglet.
Actuellement j'ai le graphique comme l'exemple du lien ci-dessus mais je voudrais rajouter un deuxième graphique, mais ça fait plus sapin de noêl que autre chose

Alors peut-être que la boucle n'est pas la bonne mais mes différents tests ne donnent rien.
Si vous avez une idée je suis preneur.
Merci
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
Global $Graphic1, $Graphic2
#Region ### START Koda GUI section ### Form=
Global $Form2 = GUICreate("Boite de dialogue à onglets", 456, 313, 302, 218)
GUISetIcon("D:\005.ico", -1)
Global $PageControl1 = GUICtrlCreateTab(8, 8, 396, 256)
Global $TabSheet1 = GUICtrlCreateTabItem("Onglet 1")
Global $Button1 = GUICtrlCreateButton("Valider", 166, 272, 75, 25)
Global $Button2 = GUICtrlCreateButton("Annuler", 246, 272, 75, 25)
Global $TabSheet2 = GUICtrlCreateTabItem("Onglet 2")
Global $btTestOnglet2 = GUICtrlCreateButton("Exit", 166, 222, 75, 25)
Global $TabSheet3 = GUICtrlCreateTabItem("Onglet 3")
Global $bt1Onglet3 = GUICtrlCreateButton("Calcul", 166, 222, 75, 25)
Global $bt2Onglet3 = GUICtrlCreateButton("Valider", 240, 222, 75, 25)
;~ Global $Graphic2 = GUICtrlCreateGraphic(112, 32, 225, 161)
;~ GUICtrlSetGraphic(-1, $GUI_GR_PIE, 63, 68, 55, 45, 315)
;~ GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 45, 26, 21, 18)
;~ GUICtrlSetState(-1, $GUI_ONTOP)
_Grahique2()
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_Grahique()
Do
$nMsg = GUIGetMsg()
If GUICtrlRead($PageControl1) = 0 Then
GUICtrlSetState($Graphic1, $GUI_ONTOP)
Switch $nMsg
Case $Button1 ;pour ajouter des points
_calcul()
Case $Button2
GUICtrlDelete($Graphic1)
_Grahique()
EndSwitch
Else
GUICtrlSetState($PageControl1, $GUI_ONTOP)
EndIf
Switch $nMsg
Case $btTestOnglet2
MsgBox(0, "TEST", "OK Onglet 2")
EndSwitch
;~ GUICtrlSetState($Graphic1, $GUI_HIDE)
GUICtrlSetState($Graphic2, $GUI_SHOW)
GUICtrlSetState($Graphic2, $TabSheet3)
;~ GUICtrlSetState(-1, $GUI_ONTOP)
Switch $nMsg
Case $bt1Onglet3
_calcul2()
Case $bt2Onglet3
GUICtrlSetState($TabSheet3, $GUI_ENABLE)
MsgBox(0, "TEST", "OK Onglet 3")
GUICtrlDelete($Graphic2)
_Grahique2()
EndSwitch
Until $nMsg = $GUI_EVENT_CLOSE
;---------------------------------------------------
Func _Grahique() ;btn2
$Graphic1 = GUICtrlCreateGraphic(128, 72, 161, 161)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 79, 0)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 79, 160)
GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, 80)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 160, 80)
GUICtrlSetState(-1, $GUI_ONTOP)
;GUISetState(@SW_SHOW)
EndFunc
Func _Grahique2() ;btn2
Global $Graphic2 = GUICtrlCreateGraphic(112, 32, 225, 161)
GUICtrlSetGraphic(-1, $GUI_GR_PIE, 63, 68, 55, 45, 315)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 45, 26, 21, 18)
GUICtrlSetState(-1, $GUI_ONTOP)
EndFunc
Func _calcul() ; bien sur ici pas de vrai calcul pour l'exemple, juste des points
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 40, 40, 6, 6)
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 110, 40, 6, 6)
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 40, 110, 6, 6)
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 110, 110, 6, 6)
GUICtrlSetGraphic($Graphic1, $GUI_GR_REFRESH)
GUISetState(@SW_SHOW)
EndFunc
Func _calcul2() ; bien sur ici pas de vrai calcul pour l'exemple, juste des points
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 20, 20, 6, 6)
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 80, 20, 6, 6)
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 20, 80, 6, 6)
GUICtrlSetGraphic($Graphic1, $GUI_GR_RECT, 80, 80, 6, 6)
GUICtrlSetGraphic($Graphic1, $GUI_GR_REFRESH)
GUISetState(@SW_SHOW)
EndFunc