[SOLVED] Transparent Window
-
- Enthusiast
- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
[SOLVED] Transparent Window
Does anybody know how to set the window background color to be TRANSPARENT?
Last edited by SkyManager on Tue Feb 08, 2011 6:49 am, edited 1 time in total.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Transparent Window
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
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Transparent Window
Thanks ! Excellent !! 

-
- Enthusiast
- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
Re: Transparent Window
Thank you very much.
Re: [SOLVED] Transparent Window
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
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?
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

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
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
[HS on]
on your avatar pretty Gardenia taitensis (Tiaré)
ia ora na ...
[HS off]
on your avatar pretty Gardenia taitensis (Tiaré)
ia ora na ...

[HS off]
Re: [SOLVED] Transparent Window
You can try creating a hidden window, creating your gadgets and then unhiding the window.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![]()
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?
▓▓▓▓▓▒▒▒▒▒░░░░░