[Lazarus] Transparent Container/Panel in LCL?

Graeme Geldenhuys graeme at geldenhuys.co.uk
Mon Sep 3 16:55:47 CEST 2012


On 03/09/12 15:19, Felipe Monteiro de Carvalho wrote:
> Transparency is supported, just use TWinControl.SetShape(Region) or
> SetShape(Bitmap);

It seems some people have different definitions of "transparency". Will 
that make the TTransparentContainer clear like glass? Will I see through 
it and see the main form's tiled canvas?

Anyway, I'm not 100% sure how to your the TRegion, so tried the 
following. Still no luck. The TTransparentContainer doesn't look 
"visually" transparent / see-thru.


procedure TForm1.FormCreate(Sender: TObject);
var
   r: TRegion;
begin
   Width := 400;

   r := TRegion.Create;
   FMyContainer := TTransparentContainer.Create(self);
   FMyContainer.Parent := self;
   with FMyContainer do
   begin
     Left := 50;
     Top := 50;
     Width := 300;
     Height := 200;
     r.AddRectangle(0, 0, FMyContainer.Width, FMyContainer.Height);
     SetShape(r);
   end;

   ...
end;


See attached image for the results.


Regards,
   - Graeme -

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test2.png
Type: image/png
Size: 5144 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120903/43cac8af/attachment-0003.png>


More information about the Lazarus mailing list