unit1.pas

来自「Delphi高级界面特效制作百例源代码,这是随书源代码部分,不知可否」· PAS 代码 · 共 103 行

PAS
103
字号
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ALed, ExtCtrls;

type
  TForm1 = class(TForm)
    ALed1: TALed;
    ALed2: TALed;
    ALed3: TALed;
    ALed4: TALed;
    ALed5: TALed;
    ALed6: TALed;
    ALed7: TALed;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    i1,i2,i3,i4,i5,i6,i7 : Integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  const cl: array[0..13] of TColor = (clBlack,clMaroon,clGreen,clOlive,
                               clNavy,clPurple,clTeal,clSilver,
                               clRed,clLime,clYellow,clBlue,clFuchsia,
                               clAqua);
implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
     if i1 < 14 then
     begin
         ALed7.TrueColor := cl[i1];
     end
     else
         i1 := -1;
     if i2 < 14 then
     begin
         ALed6.TrueColor := cl[i2];
     end
     else
         i2 := -1;
     if i3 < 14 then
     begin
         ALed5.TrueColor := cl[i3];
     end
     else
         i3 := -1;
     if i4 < 14 then
     begin
         ALed4.TrueColor := cl[i4];
     end
     else
         i4 := -1;
     if i5 < 14 then
     begin
         ALed3.TrueColor := cl[i5];
     end
     else
         i5 := -1;
     if i6 < 14 then
     begin
         ALed2.TrueColor := cl[i6];
     end
     else
         i6 := -1;
     if i7 < 14 then
     begin
         ALed1.TrueColor := cl[i7];
     end
     else
         i7 := -1;
     inc(i1);
     inc(i2);
     inc(i3);
     inc(i4);
     inc(i5);
     inc(i6);
     inc(i7);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
     i1 := 0;
     i2 := i1 + 1;
     i3 := i1 + 2;
     i4 := i1 + 3;
     i5 := i1 + 4;
     i6 := i1 + 5;
     i7 := i1 + 6;
end;

end.

⌨️ 快捷键说明

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