How to change picture control width/height without modifying the picture?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fabricio234
Posts: 122
Joined: 06 Mar 2020, 21:48

How to change picture control width/height without modifying the picture?

12 Jun 2022, 15:41

This works correctly, but as the picture is so small its hard to exactly click on it to trigger the label:

Code: Select all

Gui, -Caption
Gui, Color, 0
Gui, Add, Picture, y10 +BackgroundTrans gMinimize, minimize.png
Gui, Show, w100 h50, Gui1
When i try to set a width and height to the picture control, it modify something and the picture get white:

Code: Select all

Gui, 2:-Caption
Gui, 2:Color, 0
Gui, 2:Add, Picture, y10 w32 h32 +BackgroundTrans gMinimize, minimize.png

WinGetPos, X, Y, W, H, Gui1
X := X+W+50
Gui, 2:Show, x%x% y%y% w100 h50, Gui2
Return
Code_2022-06-12_17-42-42.png
Code_2022-06-12_17-42-42.png (1.28 KiB) Viewed 341 times
What else i could try?
Attachments
minimize.png
minimize.png (86 Bytes) Viewed 344 times
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: How to change picture control width/height without modifying the picture?

12 Jun 2022, 15:49

The picture control contains the complete image and nothing else. The image will be scaled to whatever dimensions you set.

Explained: Picture
To retain the image's actual width and/or height, omit the W and/or H options. Otherwise, the image is scaled to the specified width and/or height (this width and height also determines which icon to load from a multi-icon .ICO file). To shrink or enlarge the image while preserving its aspect ratio, specify -1 for one of the dimensions and a positive number for the other. For example, specifying w200 h-1 would make the image 200 pixels wide and cause its height to be set automatically. If the picture cannot be loaded or displayed (e.g. file not found), the control is left empty and its width and height are set to zero.
To set the image's position within the GUI, you can set an x and y position for the picture control.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 382 guests