unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons;

type
  TMainForm = class(TForm)
    Panel: TPanel;
    BitBtn1: TBitBtn;
    Timer1: TTimer;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);

  private
    Kolory : array of TColor;
	 idx    : Integer;

  public

  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

procedure TMainForm.BitBtn1Click(Sender: TObject);
begin
	SetLength(Kolory, 0);
   Close();
end;

procedure TMainForm.FormCreate(Sender: TObject);
begin
	idx := 0;

   SetLength(Kolory, 6);

	Kolory[0] := clRed;
	Kolory[1] := clInfoBk;
	Kolory[2] := clBlue;
	Kolory[3] := clCream;
	Kolory[4] := clMaroon;
	Kolory[5] := clSkyBlue;
end;

procedure TMainForm.Timer1Timer(Sender: TObject);
var
	poz : Integer;

begin
   Inc(idx);

   if idx > 5 then idx := 0;

   Panel.Color := Kolory[idx];
end;

end.
