Fadi Posted October 5, 2021 Share Posted October 5, 2021 Hi, I'm trying to create a gui with multiple page (using the next button). On each pages, i want to include a different picture (Png or bmp) and at the last step execute an exe file. I was trying to use the example in the link below, but no success. Any idea? expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIListBox.au3> #include <GDIPlus.au3> Global $frame[7][7] Global $step = 1 Global $steps_min = 1 Global $steps_max = 7 _GDIPlus_Startup() $Form1 = GUICreate("Bla Bla Bla", 641, 481, 382, 192) $Button1 = GUICtrlCreateButton("Previous", 392, 448, 75, 25, 0) $Button2 = GUICtrlCreateButton("Cancel", 472, 448, 75, 25, 0) $Button3 = GUICtrlCreateButton("Next", 552, 448, 75, 25, 0) Global $hImage1 = _GDIPlus_ImageLoadFromFile("Picture1.bmp") $Label1 = GUICtrlCreateLabel("", 8, 16, 620, 41, $SS_RIGHT) GUICtrlSetFont(-1, 24, 800, 0, "Arial") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Label2 = GUICtrlCreateLabel("Test", 8, 56, 615, 25, $SS_RIGHT) GUICtrlSetFont(-1, 16, 800, 0, "Arial") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;Start creating frames $offset_x = 8 $offset_y = 109 ; Draw PNG image Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Form1) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage1, 300, 300) ;Frame 1 $frame[1][0] = 1 $frame[1][1] = GUICtrlCreateLabel("Step1", $offset_x, $offset_y, 625, 321) ;Frame 2 $frame[2][0] = 1 $frame[2][1] = GUICtrlCreateLabel("Step2", $offset_x + 8, $offset_y , 350, 100) ;Frame 3 $frame[3][0] = 1 $frame[3][1] = GUICtrlCreateLabel("Step3", $offset_x + 8, $offset_y , 350, 100) ShellExecute("File.exe") Link to comment Share on other sites More sharing options...
Solution sudeepjd Posted October 11, 2021 Solution Share Posted October 11, 2021 It may be easier to use a GUICtrlCreatePic and then use GUICtrlSetImage to change the pictures for each of the pages? Then once you reach the end, you can execute the file. If you are looping over a series of images, put the image paths into an Array and loop over the array on each click of the button until you reach then end and then execute the file. Something along the lines of the below code. expandcollapse popup#include <GUIConstantsEx.au3> AutoItSetOption("GUIOnEventMode", 1) Global $imgArr = ["image_1.jpg", "image_2.jpg", "image_3.jpg", "image_4.jpg"] Global $pos = 0 $g_hBase = GUICreate("Test UI", 500, 520, -1, -1, -1, -1) $pic = GUICtrlCreatePic(@ScriptDir & "\resources\images\" & $imgArr[$pos], 5, 10, 500, 436) $btnBack = GUICtrlCreateButton("<< Move Back", 10, 470, 100, 30) $btnFront = GUICtrlCreateButton("Move Forward >>", 120, 470, 100, 30) GUISetOnEvent($GUI_EVENT_CLOSE , "_Exit") GUICtrlSetOnEvent($btnBack, "changeImg") GUICtrlSetOnEvent($btnFront, "changeImg") GUISetState(@SW_SHOW) While 1 Sleep(100) Wend Func _Exit() Exit EndFunc Func changeImg() If @GUI_CtrlId = $btnBack Then $pos = $pos-1 If $pos=-1 Then $pos = 0 ElseIf @GUI_CtrlId = $btnFront Then $pos = $pos+1 If $pos>Ubound($imgArr)-1 Then $pos = Ubound($imgArr)-1 EndIf GUICtrlSetImage($pic, @ScriptDir & "\resources\images\" & $imgArr[$pos]) If $pos=Ubound($imgArr)-1 Then GUICtrlSetData($btnFront, "Execute File") Else GUICtrlSetData($btnFront, "Move Front >>") EndIf EndFunc Fadi 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now