⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timerexample.pas

📁 《delphi数据库设计与实例开发》随书光盘
💻 PAS
字号:
unit TimerExample;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus, ExtDlgs, ComCtrls, jpeg, Buttons;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    BitBtn1: TBitBtn;
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    procedure Timer1Timer(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);

  private
    { Private declarations }
    count:integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.Timer1Timer(Sender: TObject);
begin
 case count of
  0:Image1.Visible:=true;     //显示Image1
  1:
    begin
     Image2.Visible:=true;    // 显示Image2
     Image1.Visible:=False;
    end ;
  2:
    begin
     Image3.Visible:=true;    // 显示Image3
     Image2.Visible:=False;
    end;
  3:
    begin
     Image4.Visible:=true;    // 显示Image4
     Image3.Visible:=False;
    end;
  4:
    begin
     Image5.Visible:=true;   // 显示Image5
     Image4.Visible:=False;
    end;
 end;
 count:=count+1;            //计数器加1
 if count>=6 then
  begin
  count:=0;                //计数器清零
  Image5.Visible:=False;
  end;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  count:=0; //计数器设初始值
  timer1.Enabled:=true; //使Timer组件可用
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -