Make a control transparent
Is there any way to make a control transparent like butt开发者_运维知识库on, edit, panel or etc...? I mean something like opacity or alpha blend that we have in form property.
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.
Take a look at the Win32 windows styles, especially WS_TRANSPARENT (or WS_EX_TRANSPARENT).
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.
精彩评论