Page 1 of 1

How do I add a picture to a button I'm too inexperienced

Posted: 04 Apr 2020, 03:01
by wadeinator74
I made a program to turn off my computer when I'm across the room with a remote but I would accidentally press it too often so I'm trying to add a button that I can press to cancel the action. I figured out how to do all of this but now I want to make the button a black picture because the default color of the button is really bright and I'm usually turning off my pc with the remote because I'm falling asleep. I tried to figure it out but it seems very complicated to use a picture for the button.

Code: Select all

Gui, Add, Button, x0 y0 w2560 h1440 gCancel
Gui, +AlwaysOnTop -Caption +Border
Gui, Color, Black

AppsKey::
Gui, Show, x0 y0 w2558 h1440, The Gui
sleep 10000
Shutdown, 8
return,

Cancel:
Reload

Re: How do I add a picture to a button I'm too inexperienced  Topic is solved

Posted: 04 Apr 2020, 03:33
by boiler
The easiest way is just to add a picture instead of a button, and because it still has the gCancel option, it will still go to the Cancel label when you click the picture.

Code: Select all

Gui, Add, Picture, x0 y0 w2560 h1440 gCancel, C:\MyPath\MyPic.jpg
Gui, +AlwaysOnTop -Caption +Border
Gui, Color, Black

AppsKey::
Gui, Show, x0 y0 w2558 h1440, The Gui
sleep 10000
Shutdown, 8
return,

Cancel:
Reload

Re: How do I add a picture to a button I'm too inexperienced

Posted: 04 Apr 2020, 03:43
by Hellbent
To add to what Boiler said, you can also check out
ImageButtons by justme for a more advanced method.