Page 1 of 1

[SOLVED] Transparent Window

Posted: Sun Feb 06, 2011 4:32 am
by SkyManager
Does anybody know how to set the window background color to be TRANSPARENT?

Re: Transparent Window

Posted: Sun Feb 06, 2011 9:34 am
by IdeasVacuum
There is an API way: Set the Window Background to a specific colour and then set that colour as transparent.

Code: Select all

#WIN = 0

Procedure ShowWin()
;-------------------
If OpenWindow(#WIN, 0, 0, 300, 300, "Transparent Window",#PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)

              SetWindowColor(#WIN,#Blue)
              SetWindowLong_(WindowID(#WIN), #GWL_EXSTYLE, #WS_EX_LAYERED | #WS_EX_TOPMOST)
              SetLayeredWindowAttributes_(WindowID(#WIN),#Blue,0,#LWA_COLORKEY)

EndIf

EndProcedure

ShowWin()

Repeat
 
       iEvent.i = WaitWindowEvent(1)
 
Until iEvent = #PB_Event_CloseWindow
 
End

Re: Transparent Window

Posted: Sun Feb 06, 2011 10:31 am
by dobro
Thanks ! Excellent !! :D

Re: Transparent Window

Posted: Tue Feb 08, 2011 6:49 am
by SkyManager
Thank you very much.

Re: [SOLVED] Transparent Window

Posted: Fri Apr 15, 2011 6:08 am
by Primus
I'm using a code like that to create a transparent window, but I encountered a problem:

When hiding and un-hiding gadgets, the desktop shines through for the glimpse of a second.

It's just a short flash, but with a sufficient amount of gadgets, it becomes annoying. Besides, it doesn't look exactly professional if parts of your software suddenly disappear without an apparent reason :lol:

I already tried SmartWindowRefresh, but it doesn't do the trick.

Now, I know that hiding requires to redraw the window, but isn't there a way to do it without the abovementioned effect? For example, isn't it possible to create an additional layer which is excluded from the refreshing process?

Re: [SOLVED] Transparent Window

Posted: Fri Apr 15, 2011 7:15 am
by Primus
Found a solution myself: I use a parent window that has the same background as the main window. That way, the background doesn't vanish if the gadgets of the main window are modified.

Re: [SOLVED] Transparent Window

Posted: Fri Apr 15, 2011 8:45 am
by dobro
[HS on]
on your avatar pretty Gardenia taitensis (Tiaré)
ia ora na ... ;)
[HS off]

Re: [SOLVED] Transparent Window

Posted: Tue May 10, 2011 5:18 pm
by Nituvious
Primus wrote:I'm using a code like that to create a transparent window, but I encountered a problem:

When hiding and un-hiding gadgets, the desktop shines through for the glimpse of a second.

It's just a short flash, but with a sufficient amount of gadgets, it becomes annoying. Besides, it doesn't look exactly professional if parts of your software suddenly disappear without an apparent reason :lol:

I already tried SmartWindowRefresh, but it doesn't do the trick.

Now, I know that hiding requires to redraw the window, but isn't there a way to do it without the abovementioned effect? For example, isn't it possible to create an additional layer which is excluded from the refreshing process?
You can try creating a hidden window, creating your gadgets and then unhiding the window.