Find out TScrollBox contents height

31 views Asked by At

Is there a standard way to find out contents height of a TScrollBox?

By now I ended up with a following workaround:

function ScrollBoxContentsHeight(AScrollBox: TScrollBox): Integer;
var
  i, ctlBottom: Integer;
  ctl: TControl;
begin
  Result := 0;
  for i := 0 to AScrollBox.ControlCount - 1 do begin
    ctl := AScrollBox.Controls[i];
    ctlBottom := ctl.Top + ctl.Height;
    if Result < ctlBottom then
      Result := ctlBottom;
  end;
end;
0

There are 0 answers