jazzyjeff Posted November 30, 2022 Share Posted November 30, 2022 It's been a minute here since I last used Autoit for a project, so I am getting back into this for a GUI project. I am wondering if someone can help me why the Picture doesn't update when I click a menu item and it resizes the gui and recreates the Picture control? I've tried adding GUICtrlDelete($pic) after the Test menu option is selected but to no avail. The picture just doesn't display when i try to update it after clicking the menu button. #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <StaticConstants.au3> #Region ### START Koda GUI section ### Form= $formMain = GUICreate("TestGUI", 400, 150, 50, 50) $pic = GUICtrlCreatePic(@TempDir & "\test.jpg",10,20,50,50) $menuItemFile = GUICtrlCreateMenu("&File") $menuFileTest = GUICtrlCreateMenuItem("&Test", $menuItemFile) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $menuFileTest WinMove("TestGUI","",50,50,600,600) $pic = GUICtrlCreatePic(@TempDir & "\test2.jpg",10,20,600,600) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Musashi Posted November 30, 2022 Share Posted November 30, 2022 (edited) Try : [...] Case $menuFileTest GUICtrlDelete($pic) WinMove("TestGUI","",50,50,600,600) $pic = GUICtrlCreatePic(@TempDir & "\test2.jpg",10,20,600,600) [...] EDIT : It works fine for me with GUICtrlDelete($pic) Just to make sure both .jpg files are present, copy them to the script directory and use @ScriptDir instead of @TempDir. Edited November 30, 2022 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Zedna Posted November 30, 2022 Share Posted November 30, 2022 Also look at GUICtrlSetImage() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
jazzyjeff Posted December 1, 2022 Author Share Posted December 1, 2022 Thanks Musashi. I thought this would work for me too, but for some reason it isn't. I tried using @ScriptDir too, but this didn't help. All I see is this. No image inside Link to comment Share on other sites More sharing options...
jazzyjeff Posted December 1, 2022 Author Share Posted December 1, 2022 Zedna, I did try GUICTRLSETImage, and that actually does show the image. However, the image that is shown is so small it's not using the pixel size of the actual image. Looks like 128x128, which from the help suggest that this function is for icons, so makes sense. Not really what I want. Link to comment Share on other sites More sharing options...
jazzyjeff Posted December 1, 2022 Author Share Posted December 1, 2022 Thanks for all the help, I started looking at GDIPlus and using the help file to find a solution to this. I have it working now. Thank you all. 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