[Lazarus] Transparent Container/Panel in LCL?

Graeme Geldenhuys graeme at geldenhuys.co.uk
Mon Sep 3 18:10:40 CEST 2012


On 03/09/12 16:11, Felipe Monteiro de Carvalho wrote:
> The code works as expected. Translucency is not supported, only full
> transparent or full opaque.

I want "full transparent" or "100% see-thru". Like I said... there seems 
to be a 101 definitions of "transparent" in this mailing list. I got the 
same confusing answers back in 2009.


> If you set a region that includes the entire control, by definition
> nothing will change. You need to include in your region what you want
> to include. In this case the text+button.

OK, so as a sample, I included a 5x5 region to be opaque, and by your 
definition, everything else should be "full transparent/see-thru".

So I did this..


   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, 10, 10);
     SetShape(r);
   end;


Now as you can see the container is much larger than 10x10, so I should 
see a grey 10x10 block, and the rest should be the background logo of 
the main form.

Yet, nothing changed. The output at runtime looks exactly like the image 
I attached in my previous message. The whole container is painted grey, 
even though I this time defined a smaller region.

It seems my initial assumption is still correct. Transparency in 
LCL-GTK2 at least is not supported. I say LCL-GTK2, because that is 
currently the only widgetset I have tested.

If you still disagree with my assumption, could you possibly take my 
test code (attached) and see if you can get a working fully 100% 
transparent (looking like clear glass) see-thru container? Something 
where the main forms tiled background will show through. Ignoring the 
Label and Button for now. I would very much appreciate your help with 
this. I simply can't get it to work.


Regards,
   - Graeme -

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tile_background.tar.gz
Type: application/x-gzip
Size: 4438 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120903/1624236f/attachment-0003.bin>


More information about the Lazarus mailing list