+ -
当前位置:首页 → 问答吧 → 5,6年没做程序了,朋友让帮个小忙,时间紧没时间复习语法啥的了!

5,6年没做程序了,朋友让帮个小忙,时间紧没时间复习语法啥的了!

时间:2011-09-20

来源:互联网

要求 和电视上抽奖那样,一点按钮 一串数字开始滚动,再一点这个按钮就停止!
求段程序,能具体点最好!分数大大的有!
源程序发给我也行:[email protected]

作者: 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.

作者: mscf   发布时间: 2011-09-21