Jump to content

display Image on GUI


Recommended Posts


I have a large GUI window, on which I would like to display a smaller image at a certain position.
The script used to work with GuiCtrlCreatePic and GUICtrlSetImage to update, but due to changes in AutoIt it no longer works, because the images scale incorrectly.

So I've been trying to figure out how to get this done with GDI functions. All examples I have found so far turn an entire GUI into a placeholder for the image with _GDIPlus_GraphicsCreateFromHWND.

So does anyone know if it is possible to assign a certain area of a GUI to display a picture, or a workaround to get the same result?

My code is a bit messy at the moment, so I can't post my code at the moment, but will de later if necessary.

Many thanks in advance!


Link to comment
Share on other sites

I'm guessing you found this thread? 

If not, it's the one I'm looking at using to get scaling right for "thumbnails" in my GUI.  Once I get that part going, I'll post back to you with how I did it.


Using AutoIt v3.3.14.5 and SciTE version 4.2.0

Link to comment
Share on other sites


Thank you all for your help and replies. I could not get it to work with those methods, because they did not match exactly what I need and I'm not experienced enough to get it to adapt them to my situation.

I did find a workaround for my problem though. Since the problem was that GUICtrlSetImage resizes the image to the size of the -previously- set image, I first set the image to a 'dummy' image with the exact correct size as defined in GuiCtrlCreatePic. Then I replace it with the correct image (which can be of different size, but must always be displayed with the same size in the GUI).

for example:

 GUICtrlSetImage($Picture,"dummy_with_correct size.jpg")

I think that if I make a new script from scratch I will try to figure out how to use only GDI, but for now this solution is just one extra line of code and works well :-)


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