Armin Taghavizad
Armin Taghavizad

Reputation: 1685

Make a control transparent

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.

Upvotes: 6

Views: 6304

Answers (3)

Remy Lebeau
Remy Lebeau

Reputation: 598174

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.

Upvotes: 0

Dian
Dian

Reputation: 1188

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.

Upvotes: 3

Karlth
Karlth

Reputation: 3275

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

Upvotes: 1

Related Questions