这跟你的Label和Edit的最大长度有关。 以下源代码可供参考: 生成从左到右的三排SpeedButton. for i:=0 to 29 do begin spdButton:=TSpeedButton.Create(Panel26); with spdButton do begin Height:=sbWordEdit.Height; //高度 Width:=sbWordEdit.Width; //宽度 Caption:=trim(IntToStr(i)); Layout:=sbWordEdit.Layout; Parent:=Panel26; OnClick:=sbWordEdit.OnClick; Top:=10+Height*(i div 3); Left:=16+Width*(i Mod 3); end; end;
procedure TForm1.Button1Click(Sender: TObject); var iFHeigh : Integer; iLab,icount : Integer; LLab : TLabel; begin iFHeigh := Form1.Height; for iCount := 0 to 10 do begin lLab := TLabel.Create(Self); lLab.Caption := '第'+IntToStr(iCount)+'个'; lLab.Top := iCount * (iFHeigh div 10); lLab.Left := 100; lLab.Visible := True; lLab.Parent := Form1; end; end;
以下源代码可供参考:
生成从左到右的三排SpeedButton.
for i:=0 to 29 do
begin
spdButton:=TSpeedButton.Create(Panel26);
with spdButton do
begin
Height:=sbWordEdit.Height; //高度
Width:=sbWordEdit.Width; //宽度
Caption:=trim(IntToStr(i));
Layout:=sbWordEdit.Layout;
Parent:=Panel26;
OnClick:=sbWordEdit.OnClick;
Top:=10+Height*(i div 3);
Left:=16+Width*(i Mod 3);
end;
end;
var
iFHeigh : Integer;
iLab,icount : Integer;
LLab : TLabel;
begin
iFHeigh := Form1.Height;
for iCount := 0 to 10 do
begin
lLab := TLabel.Create(Self);
lLab.Caption := '第'+IntToStr(iCount)+'个';
lLab.Top := iCount * (iFHeigh div 10);
lLab.Left := 100;
lLab.Visible := True;
lLab.Parent := Form1;
end;
end;
DelUser(探索者) ( ) 信誉:100 2003-04-23 11:06:00
老兄你的为什么在我前面?
procedure TForm1.Button1Click(Sender: TObject);
var test:Tedit;//个数很多就用数组
begin
test:=Tedit.Create(application);
test.Top:=100;//数据库中读取位置
test.Left:=100;
test.Parent:=form1;//告诉他所属的父窗体!
end;
其他的东西依次类推!
Label1 := TLabel.Create(Self);
Lable1.Visible := True;
Lable1.Parent := Form1;
Lable1.Caption:='Lable1';
我的qq:5938099
msn:[email protected]