Jump to content
(Public Beta) HyperSpin 2 is now available for everyone ×

AHK: Trying to add a picture with transparent background over another picture in a GUI


TheManuel

Recommended Posts

Posted

Sorry to post here but I can't seem to get any help in the AHK forum itself, and there are some members of the HS community that are pretty knowledgeable with AHK.

I am trying to create a simple GUI where I add an image, then overlay another image with a transparent background over it. Essentially, the second image just says "Loading" on top of the original one.

I've tried the code below but the "Loading" image simply places itself over the other one with a white background and completely obscures it. If I swap the order in which GUI 1 and 2 appear, then the same problem happens but with the "Nightmare" image blocking the other one.

Gui, 1: -Caption +ToolWindow 
Gui, 1: Add, Picture, h%A_ScreenHeight% w%A_ScreenWidth% AltSubmit BackgroundTrans, D:\FrontEnd\HyperSpin\Splash Images\Loading.png
Gui, 2: -Caption +ToolWindow 
Gui, 2: Add, Picture, h%A_ScreenHeight% w%A_ScreenWidth%, D:\FrontEnd\HyperSpin\Splash Images\SC2 Nightmare.jpg
Gui, 2: Show, x-10 y-7 h%A_ScreenHeight% w%A_ScreenWidth%
Sleep, 1000
Gui, 1: Show, x-10 y-7 h%A_ScreenHeight% w%A_ScreenWidth%

I tried also adding both images within the same GUI command, with and without the AltSubmit parameter. Also, I am certain the image has a transparent background, as I've verified it with other applications.

Any help would be appreciated.

Posted
10 hours ago, TheManuel said:

Sorry to post here but I can't seem to get any help in the AHK forum itself, and there are some members of the HS community that are pretty knowledgeable with AHK.

I am trying to create a simple GUI where I add an image, then overlay another image with a transparent background over it. Essentially, the second image just says "Loading" on top of the original one.

I've tried the code below but the "Loading" image simply places itself over the other one with a white background and completely obscures it. If I swap the order in which GUI 1 and 2 appear, then the same problem happens but with the "Nightmare" image blocking the other one.


Gui, 1: -Caption +ToolWindow 
Gui, 1: Add, Picture, h%A_ScreenHeight% w%A_ScreenWidth% AltSubmit BackgroundTrans, D:\FrontEnd\HyperSpin\Splash Images\Loading.png
Gui, 2: -Caption +ToolWindow 
Gui, 2: Add, Picture, h%A_ScreenHeight% w%A_ScreenWidth%, D:\FrontEnd\HyperSpin\Splash Images\SC2 Nightmare.jpg
Gui, 2: Show, x-10 y-7 h%A_ScreenHeight% w%A_ScreenWidth%
Sleep, 1000
Gui, 1: Show, x-10 y-7 h%A_ScreenHeight% w%A_ScreenWidth%

I tried also adding both images within the same GUI command, with and without the AltSubmit parameter. Also, I am certain the image has a transparent background, as I've verified it with other applications.

Any help would be appreciated.

 

Gui, 1: Add, Picture, h%A_ScreenHeight% w%A_ScreenWidth% +BackgroundTrans, D:\FrontEnd\HyperSpin\Splash Images\Loading,png

49733.png
Posted

Thanks for the tip.  I was able to get it working last night with the code below, following some advice from someone on the AHK reddit.  However, I will check out your suggestion of adding "+" before "BackgroundTrans" as it would be a more elegant solution if it works.  It will be sad if all I was missing was a plus sign, but unsurprising in the world of coding.

Gui, 1: -Caption +ToolWindow +LastFound
Gui, 1: Color, 000001
Gui, 1: Add, Picture, w800 h200, D:\FrontEnd\HyperSpin\Splash Images\Loading.png
Gui, 2: -Caption +ToolWindow
Gui, 2: Add, Picture, w%A_ScreenWidth% h%A_ScreenHeight%, D:\FrontEnd\HyperSpin\Splash Images\SC2 Nightmare.jpg
Gui, 2: Show, x-10 y-7 w%A_ScreenWidth% h%A_ScreenHeight%
Gui, 1: Show, x700 y700 w800 h200
WinSet, TransColor, 000001

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...