动态创建子控件

来源:互联网 发布:视频录像软件 编辑:程序博客网 时间:2024/04/28 23:19
var  j, k, i: integer;  sName: string;begin  k := 0;  for j := 2 to 5 do    if not Assigned(TScrollBox(FindComponent('s' + inttostr(j)))) then    begin      with TScrollBox.Create(Self) do      begin        Name := 'S' + IntToStr(j);        sName := Name;        Parent := Self;        k := K + 80;   //BoundsRect := Bounds(aLeft, H, aWidth, aHeigh);        Left := k;        Width := 60;        Top := 80;        Height := 50;        Show;        for I := 1 to 5 do          with TSpeedButton.Create(Self) do          begin            Name := 'B' + InttoStr(I) + IntToStr(j);            parent := TScrollBox(Self.FindComponent(sName));            Caption := name;            Show;          end;      end;    end;end;

原创粉丝点击