procedure TForm1.Button1Click(Sender: TObject);
var
L: TStringList;
i: Integer;
h: Integer;
begin
L := TStringList.Create;
FindAllFiles(L, 'c:\', '*.*', false);
for i := 0 to L.Count-1 do
begin
with TLabel.Create(self) do
begin
Parent := Scrollbox1;
Caption := L[i];
h := Height;
end;
end;
L.Free;
Scrollbox1.ChildSizing.Layout := cclTopToBottomThenLeftToRight;
Scrollbox1.ChildSizing.ControlsPerLine := 1; // Since we fill columns first, the "line" here runs vertically --> 1 control per column
Scrollbox1.ChildSizing.HorizontalSpacing := 12; // horizontal distance between the labels
Scrollbox1.HorzScrollbar.Tracking := true;
Scrollbox1.ClientHeight := h;
end;