Sign in to follow this  
Followers 0
willichan

GUICtrlCreatePic() without stretch

6 posts in this topic

Is there any way to put a picture on a GUI without stretching/scrunching it?

For example:

Global $frm_main_pic_bg = GUICtrlCreatePic("", 8, 48, 420, 148)
...
    GUICtrlSetImage($frm_main_pic_bg, $selected_pic)

When GUICtrlSetImage() sets the picture, it is resized to fit the 420x148 size of $frm_main_pic_bg. This leads to all kinds of image distortion when the GUI is resized. I would like to have just the part of the picture that fits the area displayed if the picture is larger than the display area, or the whole picture in its true size if the display area is larger.

Is there a way to accomplish this?

Share this post


Link to post
Share on other sites



GUICtrlSetPos()

Thank you for a quick reply.

Unfortunately, that will only move or resize the picture control. The picture displayed will still be stretched/squished to fit the size of the control. I could use it in cases where the dimensions of the image are smaller than the GUI, but when larger, I still get distortion.

To continue the example above, if the control is 420x148, and the image is 800x600, I only want the top-left 420x148 pixels of the image to display, not the whole image.

Share this post


Link to post
Share on other sites

what about gdi+ (bitmapclonearea and graphicsdrawimagerect) ?

Share this post


Link to post
Share on other sites

Do you mean somethin' like this?:

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Do you mean somethin' like this?

Yes, that is exacly what I needed. Thanks. Edited by willichan

Share this post


Link to post
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
Sign in to follow this  
Followers 0