📄 unit1.~pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,DateUtils;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Button2: TButton;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
EditArry:Array of TEdit;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
Cnt:Integer;
FromTime:TDateTime;
begin
if Length(EditArry)>0 then
begin
for i:=0 to Length(EditArry)-1 do
begin
FreeAndNil(EditArry[i]);
end;
end;
Cnt:=StrToIntDef(Edit1.Text,0);
if Cnt>0 then
begin
SetLength(EditArry,Cnt);
FromTime:=Now();
for i:=0 to Cnt-1 do
begin
EditArry[i]:=Tedit.Create(form1);
EditArry[i].Text:=Inttostr(i);
EditArry[i].Left:=Trunc((i mod 9)*40)+10;
EditArry[i].Top:=Trunc(i/9)*20+50;
EditArry[i].Width:=40;
EditArry[i].Height:=20;
EditArry[i].Parent:=Form1;
EditArry[i].Visible:=True;
end;
Cnt:=MilliSecondsBetween(Now(),FromTime);
Label1.Caption:=Inttostr(Cnt);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
Cnt:Integer;
FromTime:TDateTime;
begin
if Length(EditArry)>0 then
begin
for i:=0 to Length(EditArry)-1 do
begin
FreeAndNil(EditArry[i]);
end;
end;
Cnt:=StrToIntDef(Edit1.Text,0);
if Cnt>0 then
begin
SetLength(EditArry,Cnt);
FromTime:=Now();
for i:=0 to Cnt-1 do
begin
EditArry[i]:=Tedit.Create(nil);
EditArry[i].Text:=Inttostr(i);
EditArry[i].Left:=Trunc((i mod 9)*40)+10;
EditArry[i].Top:=Trunc(i/9)*20+50;
EditArry[i].Width:=40;
EditArry[i].Height:=20;
EditArry[i].Parent:=Form1;
EditArry[i].Visible:=True;
end;
Cnt:=MilliSecondsBetween(Now(),FromTime);
Label1.Caption:=Inttostr(Cnt);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -