Habe versucht es so dynamisch wie möglich zu lösen.
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var
I: Integer;
name: String;
summe: Single;
begin
summe := 0;
for I := 1 to panel2.ChildrenCount - 1 do
begin
name := panel2.Children.Items[I].name;
try
with Tlabel(FindComponent(name)) do
begin
summe := summe + Height;
summe := summe + Margins.Top;
end;
except
end;
end;
panel2.Height := summe
end;