[Lazarus] Transparent Container/Panel in LCL?

Graeme Geldenhuys graeme at geldenhuys.co.uk
Mon Sep 3 15:56:18 CEST 2012


How do I create a transparent container/panel in LCL? I tried the 
following code, and as you can see, csOpaque is not defined in the 
ControlStyle property.

   TTransparentContainer = class(TCustomControl)
     constructor Create(AOwner: TComponent); override;

constructor TTransparentContainer.Create(AOwner: TComponent);
   inherited Create(AOwner);
   // Do not include [csOpaque] because we want a transparent widget.
   ControlStyle := [csAcceptsControls, csNoFocus];

Please see attached the result at runtime. The grey box in the middle of 
the form (which contains a TLabel and TButton) is not "transparent" 
container. Not very transparent because the form's tiled background is 
not showing through.

Maybe I misunderstood the [csOpaque] option, though I though it seems 
self explanatory.

I'm using Lazarus v1.0 GTK2 under Linux with FPC 2.6.0 on 64-bit 
OpenSUSE 12.1

Any tips?

   - Graeme -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 5259 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120903/8f438bcc/attachment-0002.png>

More information about the Lazarus mailing list