灵
灵魂26
Unregistered / Unconfirmed
GUEST, unregistred user!
我用自动创建组件的方法创建了标签、文本框,我想让他们5个一行,到5个自动换行,请问这个5个一行的换行怎么实现!
如下是我创建组件的代码:
public
nEdit : array [1..30] of TEdit;
nLabel : array[1..30] of Tlabel;
procedure TForm1.FormCreate(Sender: TObject);
var
i,ie,il : Integer;
begin
il := (form1.Width-130*5)div 2
ie := (form1.Width-130*5)div 2+40;
for I := 1 to 30 do // Iterate
begin
nlabel :=Tlabel.Create(form1);
nlabel.Parent :=Form1;
nlabel.Caption :='aaa';
nlabel.Top := 20;
nLabel.Left :=il + ((i-1)*130);
nLabel.Font.Color :=clmaroon;
nEdit := TEdit.Create(Form1);
nEdit.Top := 20;
nEdit.Left := ie + ((i-1) * 130);
nEdit.Width := 70;
nEdit.Parent := Form1;
end
end
如下是我创建组件的代码:
public
nEdit : array [1..30] of TEdit;
nLabel : array[1..30] of Tlabel;
procedure TForm1.FormCreate(Sender: TObject);
var
i,ie,il : Integer;
begin
il := (form1.Width-130*5)div 2
ie := (form1.Width-130*5)div 2+40;
for I := 1 to 30 do // Iterate
begin
nlabel :=Tlabel.Create(form1);
nlabel.Parent :=Form1;
nlabel.Caption :='aaa';
nlabel.Top := 20;
nLabel.Left :=il + ((i-1)*130);
nLabel.Font.Color :=clmaroon;
nEdit := TEdit.Create(Form1);
nEdit.Top := 20;
nEdit.Left := ie + ((i-1) * 130);
nEdit.Width := 70;
nEdit.Parent := Form1;
end
end