[Lazarus] Transparent Container/Panel in LCL?

zeljko zeljko at holobit.net
Tue Sep 4 14:51:27 CEST 2012


On Monday 03 of September 2012 16:55:47 Graeme Geldenhuys wrote:
> 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.

I don't know for gtk2 atm, but eg. under Qt QPainter have opacity property 
which does thing you want. Maybe it's possible under gtk2 (by using cairo) to 
do same thing.

zeljko




More information about the Lazarus mailing list