Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
22
Добавлен:
17.04.2013
Размер:
146.43 Кб
Скачать

3.2 Листинг программы

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

StdCtrls, DBCtrls, ExtCtrls;

type

TForm1 = class(TForm)

Label1: TLabel;

TGlav: TImage;

bug1: TImage;

bug2: TImage;

GorLine1: TImage;

VertLine1: TImage;

VertLine2: TImage;

GorLine2: TImage;

Timer1: TTimer;

Button1: TButton;

run2: TImage;

run4: TImage;

run5: TImage;

run3: TImage;

Pusto: TImage;

Text1: TStaticText;

Image1: TImage;

procedure Bug1Click(Sender: TObject);

procedure Bug2Click(Sender: TObject);

procedure starting(Sender: TObject);

procedure Pr1(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Nashresize(Sender: TObject);

procedure nashclose(Sender: TObject; var Action: TCloseAction);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

t1,t2:TDateTime;

n,x:integer;

tim,b:boolean;

implementation

{$R *.DFM}

procedure TForm1.Bug1Click(Sender: TObject);

begin

t1:=Time;

Timer1.Enabled:=True;

Label1.Caption:='0:00:00';

Bug2.Visible:=True;

Bug1.Visible:=False;

b:=true;

end;

procedure TForm1.Bug2Click(Sender: TObject);

begin

t2:=Time;

Timer1.Interval:=50;

Bug2.Visible:=false;

Bug1.Visible:=True;

Timer1.Enabled:=False;

Label1.Caption:=TimeToStr(t2-t1);

end;

procedure TForm1.starting(Sender: TObject);

begin

if Form1.Width<350 then Form1.Width:=370;

if Form1.height<340 then Form1.Height:=340;

run2.Visible:=False;

run3.Visible:=False;

run4.Visible:=False;

run5.Visible:=False;

TGlav.left:=(Form1.Width-350) div 2;

Label1.left:=(Form1.Width-42) div 2;

GorLine1.Top:=Label1.Top+19;

GorLine1.Left:=(Form1.Width-100) div 2;

VertLine1.Top:=GorLine1.Top-31;

VertLine1.Left:=GorLine1.Left-3;

VertLine2.Top:=GorLine1.Top-31;

VertLine2.Left:=GorLine1.Left+100;

GorLine2.Left:=(Form1.Width-100) div 2;

GorLine2.Top:=VertLine1.Top;

Bug1.Left:=10;

Bug2.Left:=Form1.Width-15-100;

Button1.Left:=(Form1.Width-Button1.Width) div 2;

n:=2;

x:=0;

tim:=false;

b:=false;

Timer1.interval:=1;

end;

procedure TForm1.Pr1(Sender: TObject);

begin

t2:=Time;

Label1.Caption:=TimeToStr(t2-t1);

if Timer1.Interval>100 then Timer1.Interval:=1;

if b then

begin

if x+14>form1.Width-5 then x:=0;

if n=5 then

begin

n:=2;

run5.visible:=false;

run2.left:=x;

run2.visible:=true;

tim:=true;

end;

if n=4 then

begin

n:=5;

run4.visible:=false;

run5.left:=x;

run5.visible:=true;

end;

if n=3 then

begin

n:=4;

run3.visible:=false;

run4.left:=x;

run4.visible:=true;

end;

if (n=2) and (not tim) then

begin

n:=3;

run2.visible:=false;

run3.left:=x;

run3.visible:=true;

tim:=true;

end;

tim:=false;

pusto.left:=x-10;

x:=x+9;

end;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

if timer1.enabled then timer1.Interval:=5000;

end;

procedure TForm1.Nashresize(Sender: TObject);

begin

if Form1.Width<350 then Form1.Width:=390;

if Form1.height<340 then Form1.Height:=360;

TGlav.left:=(Form1.Width-350) div 2;

Label1.left:=(Form1.Width-42) div 2;

GorLine1.Top:=Label1.Top+19;

GorLine1.Left:=(Form1.Width-100) div 2;

VertLine1.Top:=GorLine1.Top-31;

VertLine1.Left:=GorLine1.Left-3;

VertLine2.Top:=GorLine1.Top-31;

VertLine2.Left:=GorLine1.Left+100;

GorLine2.Left:=(Form1.Width-100) div 2;

GorLine2.Top:=VertLine1.Top;

Bug1.Left:=10;

Bug2.Left:=Form1.Width-15-100;

Button1.Left:=(Form1.Width-Button1.Width) div 2;

Text1.left:=(form1.width-243) div 2;

Text1.top:=gorline1.top+20+20;

end;

procedure TForm1.nashclose(Sender: TObject; var Action: TCloseAction);

begin

Image1.Visible:=True;

end;

end.

Соседние файлы в папке Курсач по ОВП