Make a control transparent
Asked Answered
E

3

6

Is there any way to make a control transparent like button, edit, panel or etc...? I mean something like opacity or alpha blend that we have in form property.

Evelineevelinn answered 29/6, 2010 at 20:54 Comment(1)
You can get transparent buttons or panels in a variety of open source or free ones. You do not typically "make" your existing controls transparent, as this is usually a lot of work.Pinfish
D
3

Some components have the transparent property. In others you can choose 'none' as the color property. It differs from component to component, but not all components can be made transparent by changing a property.

You should try googling Delphi transparent components, there are downloadable components and tricks you can do to make existing components transparent.

Dorothi answered 30/6, 2010 at 6:40 Comment(4)
I googled it over 6 months and found no useful solution. It can happen because i have 3 reasons: 1- When a form can have it, other controls can have it too! 2- I've seen that in some applications 3- Anything is possible in programming, especially when you are using DELPHI! Thanks at all.Evelineevelinn
Oh, what I meant to say was I didn't think it was possible to make a component transparent by changing a property. I have actually tried making a panel transparent (not my code though), this is what I meant by tricks to make existing components transparent. I've never actually found a code that works on every component, but most of them manipulate/override/deal with the Paint procedure/method.Dorothi
Constructive answers doesn't start with "I think" or "I don't think"Hanoi
I was inexperienced and I do not like feigning certainty when I am not certain. I will edit this when I have time.Dorothi
L
1

Take a look at the Win32 windows styles, especially WS_TRANSPARENT (or WS_EX_TRANSPARENT).

Lamonica answered 29/6, 2010 at 21:4 Comment(1)
I've seen that work on Windows. I'm not sure if it does on components though... will have to research it sometime.Dorothi
B
0

Applying transparency on a child control can be done very easily using old-fashioned regions and the SetWindowRgn() function.

Applying alpha blending on a child control, on the other hand, is very difficult to do prior to Windows 8. It involves painting the parent window to a bitmap first, then alpha blending an image of the child control on top of the bitmap, then rendering the bitmap onscreen.

In Windows 8, the WS_EX_LAYERED window style (which is what Tform's TransparentColor and AlphaBlendValue properties use internally) has finally been implemented for child controls.

Bold answered 12/7, 2012 at 1:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.