Board index » delphi » Transparent programs

Transparent programs


2004-04-14 12:06:27 AM
delphi53
Hi
Please tell me how can i design forms that have transparenty in some places
like Windows Mediaplayer.
Thanks in advance
Mohammad-Reza Taikandi
 
 

Re:Transparent programs

Quote
Please tell me how can i design forms that have transparenty in some
places like Windows Mediaplayer.
Two possibilities:
- The TForm.TransparentColor and TForm.TransparentColorValue properties
(is available on Delphi 7 and works with Windows XP, I am not sure if it
works for Windows 9x and in which Delphi it was introduced)
- The SetWindowRgn API function (works for all 32-bit Windows versions
and all Delphi's)
 

Re:Transparent programs

I mean for example how can i draw a rectangle in a form and make inside of
it transparent?
"Avatar Zondertau" <XXXX@XXXXX.COM>writes
Quote
>Please tell me how can i design forms that have transparenty in some
>places like Windows Mediaplayer.

Two possibilities:

- The TForm.TransparentColor and TForm.TransparentColorValue properties
(is available on Delphi 7 and works with Windows XP, I am not sure if it
works for Windows 9x and in which Delphi it was introduced)

- The SetWindowRgn API function (works for all 32-bit Windows versions
and all Delphi's)
 

Re:Transparent programs

Quote
>Two possibilities:
>
>- The TForm.TransparentColor and TForm.TransparentColorValue
>properties (is available on Delphi 7 and works with Windows XP, i'm
>not sure if it works for Windows 9x and in which Delphi it was
>introduced)
>
>- The SetWindowRgn API function (works for all 32-bit Windows
>versions and all Delphi's)
I mean for example how can i draw a rectangle in a form and make
inside of it transparent?
In one of the ways i mentioned.
In the first case, which only works on the Windows NT family
(2000/XP/2003), you would set the TransparentColorValue property to
some color you don't use on your form and you set TransparentColor to
True. You can the use a TShape with the background color you chose to
be transparent to make an area transparent (s in your case a
rectangular TShape).
In the second case you would have to use the Windows API functions to
create a region to make visible and pass this region to SetWindowRgn
()check
msdn.microsoft.com/library/default.asp
tdraw_2him.asp for more info). This works for all 32-bit Windows
versions. You can use CreateRectRgn (check
msdn.microsoft.com/library/default.asp
ions_2h0u.asp for more info) and CombineRegion (check
msdn.microsoft.com/library/default.asp
ions_7tf2.asp for more info) with a CombineMode of RGN_XOR to create
this region.