Zest Posted February 24, 2017 Posted February 24, 2017 Hello, 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!
gi_jimbo Posted February 24, 2017 Posted February 24, 2017 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. Jimbo Using AutoIt v3.3.14.5 and SciTE version 4.2.0
gi_jimbo Posted February 25, 2017 Posted February 25, 2017 Even better. I stumbled across this post where a UDF was already written and it works flawlessly for me. It's compatible with PNG images as well which is a bonus. Jimbo Using AutoIt v3.3.14.5 and SciTE version 4.2.0
Zest Posted February 25, 2017 Author Posted February 25, 2017 Hello, 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") GUICtrlSetImage($Picture,$CorrectPicture) 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 :-)
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