5,6年没做程序了,朋友让帮个小忙,时间紧没时间复习语法啥的了!
时间:2011-09-20
来源:互联网
作者: aloelan 发布时间: 2011-09-20
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
NumArr: Array of integer;
i: integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Timer1.Enabled = true then
begin
Timer1.Enabled := false;
setlength(NumArr, 0);
end
else
begin
setlength(NumArr, 5);
NumArr[0] := 1;
NumArr[1] := 2;
NumArr[2] := 3;
NumArr[3] := 4;
NumArr[4] := 5;
i := 0;
Timer1.Enabled := true;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if i >= 5 then
begin
i := 0
end;
Edit1.Text := inttostr(NumArr[i]);
i := i + 1;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
NumArr: Array of integer;
i: integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Timer1.Enabled = true then
begin
Timer1.Enabled := false;
setlength(NumArr, 0);
end
else
begin
setlength(NumArr, 5);
NumArr[0] := 1;
NumArr[1] := 2;
NumArr[2] := 3;
NumArr[3] := 4;
NumArr[4] := 5;
i := 0;
Timer1.Enabled := true;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if i >= 5 then
begin
i := 0
end;
Edit1.Text := inttostr(NumArr[i]);
i := i + 1;
end;
end.
作者: mscf 发布时间: 2011-09-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28