Overlaying a timer on a GUI?
Posted: 09 Dec 2020, 19:22
I have a timer which I have working now which I'm trying to overlay onto a semi-transparent image. The problem is when I position the timer on the image, not only is the timer transparent but the transparency goes all the way through the image (The white square is the opaque part of the transparency) and shows the background of my desktop (The black).
https://imgur.com/a/TdXSqRV
Does anyone know how I can get the background of the timer to be the same color as the transparency image? My actual image is not white, I just changed the image to illustrate what's going on.
https://imgur.com/a/TdXSqRV
Does anyone know how I can get the background of the timer to be the same color as the transparency image? My actual image is not white, I just changed the image to illustrate what's going on.
Code: Select all
SetWorkingDir %A_ScriptDir%
URL = https://i.imgur.com/hw5wxoO.png
URLDownloadToFile, %URL%, Image.png
;On-screen display (OSD)
Gui +LastFound +AlwaysOnTop -Caption -border +ToolWindow ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
Gui, Add, Picture, +BackgroundTrans, Image.png
Gui, Color, 0c0909
Gui, Margin, 0, 0
Gui, Font, cFFFFFF s35 ; Set a large font size (35-point).
Gui, Add, Text, ym+15 x250 vMyText cBlue, 00 ; 00 serve to auto-size the window.
WinSet, TransColor, 0c0909 ; Make all pixels of this color transparent
Gui, Show, x50 y50 NoActivate ; NoActivate avoids deactivating the currently active window.
return
r:: ; hotkey r will start or reset counting
counter:=0
SetTimer, UpdateOSD, -10 ; to update immediately
SetTimer, UpdateOSD, 1000
return
UpdateOSD:
counter++
time_display:=6-counter ; 6 and not 5 because counter starts with 1
if (time_display=0)
SetTimer, UpdateOSD, off ; stops the counter
GuiControl,, MyText, %time_display%
return
esc::exitapp