1. borderless image on the desktop
- Posted by sergelli Jul 23, 2012
- 1401 views
Good morning to all
How do I make a window that displays a borderless image on the desktop? I want to display an image like an icon with transparent background. This is possible with Euphoria?
Thanks in advance
2. Re: borderless image on the desktop
- Posted by ghaberek (admin) Jul 23, 2012
- 1385 views
Good morning to all
How do I make a window that displays a borderless image on the desktop? I want to display an image like an icon with transparent background. This is possible with Euphoria?
Thanks in advance
Assuming you're on Win32Lib, use the style WM_POPUP to create a completely borderless window, then use something like setTransparentColor() and setBackgroundColor() to make the window "transparent". Finally, use either a static Bitmap control, or BitBlt() your image onto the window during a Paint event.
-Greg
3. Re: borderless image on the desktop
- Posted by sergelli Jul 23, 2012
- 1383 views
Assuming you're on Win32Lib, use the style WM_POPUP to create a completely borderless window, then use something like setTransparentColor() and setBackgroundColor() to make the window "transparent". Finally, use either a static Bitmap control, or BitBlt() your image onto the window during a Paint event.
-Greg
Thanks Greg
The bitmap plotted onto the window shows the selected color with transparency, perfectly.
I used the same background color for the bitmap and for the window {0,0,255}
But the back color of window, is not transparent.
How do I make a transparent window?
4. Re: borderless image on the desktop
- Posted by ghaberek (admin) Jul 24, 2012
- 1310 views
The bitmap plotted onto the window shows the selected color with transparency, perfectly.
I used the same background color for the bitmap and for the window {0,0,255}
But the back color of window, is not transparent.
How do I make a transparent window?
Doing some more testing, it looks like you need a few more functions to get this working correctly. What you need to do is create a "layered" window and then tell Windows what color to make transparent. This method will work on all versions of Windows since 2000.
Save this as layered.ew and include it into your program.
include Win32Lib.ew public constant xSetLayeredWindowAttributes = registerw32Function( user32, "SetLayeredWindowAttributes", {C_LONG,C_LONG,C_LONG,C_LONG}, C_UINT ) public constant LWA_COLORKEY = #0001, LWA_ALPHA = #0002 public procedure setLayeredWindow( integer id, integer layered = w32True ) integer has = controlStyle( id, WS_EX_LAYERED, w32True, STYLE_HAS ) if layered and not has then controlStyle( id, WS_EX_LAYERED, w32True, STYLE_ADD ) elsif has and not layered then controlStyle( id, WS_EX_LAYERED, w32True, STYLE_REMOVE ) end if end procedure public procedure setWindowColorKey( integer id, object colorKey ) atom hWnd = getHandle( id ) if sequence( colorKey ) then colorKey = colorValue( colorKey ) end if w32Func( xSetLayeredWindowAttributes, {hWnd,colorKey,NULL,LWA_COLORKEY} ) end procedure public procedure setWindowAlpha( integer id, integer alpha ) atom hWnd = getHandle( id ) alpha = and_bits( alpha, #FF ) w32Func( xSetLayeredWindowAttributes, {hWnd,NULL,alpha,LWA_ALPHA} ) end procedure
Then between your create() statements and your WinMain() call, set these options:
-- make this a layered window, (you could also -- use createEx() with the WS_EX_LAYERED flag) setLayeredWindow( Main, w32True ) -- the window alpha defaults to zero, which makes it -- invisible, so set it back to 255 (100%) instead setWindowAlpha( Main, 255 ) -- set the 'transparent' color key (use your color here) setWindowColorKey( Main, #FF00FF )
-Greg
5. Re: borderless image on the desktop
- Posted by sergelli Jul 24, 2012
- 1322 views
I followed the instructions and made the code below, but is not working
What can be wrong or missing?
include win32lib.ew include layered.ew --without warning ------------------------------------------------------------------------ constant WIN1 = create( Window, "Some STYLES of Windows:", 0, 0, 0, 640, 510, 0 ) ,NormPopup = create( Window, "", WIN1, 30, 375, 175, 100, {WS_POPUP, WS_BORDER, WS_SYSMENU}) --------------------------------------------------------------------------- -- make this a layered window, (you could also -- use createEx() with the WS_EX_LAYERED flag) setLayeredWindow( WIN1, w32True ) -- the window alpha defaults to zero, which makes it -- invisible, so set it back to 255 (100%) instead setWindowAlpha( WIN1, 255 ) -- set the 'transparent' color key (use your color here) setWindowColorKey( WIN1, #0000FF ) --------------------------------------------------------------------------- procedure onOpen_WIN1(integer id,integer event,sequence params) openWindow(NormPopup,Normal) end procedure setHandler(WIN1,w32HOpen,routine_id( "onOpen_WIN1" )) ---------------------------------------------------------------------- setWindowBackColor( {WIN1}, {00, 00, 255} ) setWindowBackColor( {NormPopup}, {00, 00, 255} ) setTransparentColor({00,00,255}) WinMain( WIN1, Normal ) </EUCODE>
6. Re: borderless image on the desktop
- Posted by sergelli Jul 25, 2012
- 1282 views
For those who want to know.
This work was solved with the library Modified EuWinGui Designer, made by Andreas Wagner.
This library has features for viewing images anywhere on the screen, no windows, no borders, no background color.
Thanks to Andreas Wagner.