The code is as follows:
Procedure TForm4. Button3Click (Sender: TObject);
Var
I: integer;
ScrollboxA: Tscrollbox;
PanelD: Tpanel;
The Begin
For I:=downto ComponentCount - 1 0 do
The begin
If (Tscrollbox (Components [I]). The Name='ScrollBox1') Then
Tscrollbox (Components [I]). Free;
end;
ScrollboxA:=Tscrollbox. Create (form4);
ScrollboxA. Name:='ScrollBox1';
ScrollboxA. Position. : X=184;
ScrollboxA. Position. : y=112;
ScrollboxA. Width:=641;
ScrollboxA. Height:=420;
ScrollboxA. Parent:=form4;
For I:=1 to 5 do
The begin
PanelD:=Tpanel. Create (Self);
With panelD do
The begin
Name:='panels' + InttoStr (I + 1);
Parent:=scrollboxA;
Height:=89;
Align:=TAlignLayout. AlTop;
end;
end;
end;
CodePudding user response:
165232328Look into this group, have a master can solve, XE5 are also used
CodePudding user response:
For I:=downto ComponentCount - 1 0 doThe begin
If (Tscrollbox (Components [I]). The Name='ScrollBox1') Then
Tscrollbox (Components [I]). Free;
end;
ScrollBox1 the code above is only free, but the Panel in the ScrollBox1 exists, if again by pressing the Button will be repeated to create a Panel,