TLayout changed its height depending on the height of TLabel

24 Views Asked by At

I have several Labels on my Layout. One of the Labels contains large text. The Label has an AutoSize property, WordWrap. If there is large text in it, it stretches, but Layout does not change the size. How to make Layout also resize depending on Label size???

I wrote the code, but it doesn't work. How to fix it?

procedure TForm5.Label18Resize(Sender: TObject); 
var Lab: TLabel; 
Layout: TLayout; 
begin if (Sender is TLabel) and (TLabel(Sender).Parent is TLayout) then 
begin 
Lab:= TLabel(Sender); 
Layout:= TLayOut(Lab.Parent); 
Layout.Height:= Lab.Height;   
end; 
end;
0

There are 0 best solutions below