Jump to content

GUICtrlCreatePic Update


Recommended Posts

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)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $menuFileTest
            $pic = GUICtrlCreatePic(@TempDir & "\test2.jpg",10,20,600,600)


Link to comment
Share on other sites

Try :

        Case $menuFileTest
            $pic = GUICtrlCreatePic(@TempDir & "\test2.jpg",10,20,600,600)           


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 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...