Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Main;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus, Vcl.StdCtrls, Vcl.Grids,
- Vcl.Imaging.GIFImg, Vcl.ExtCtrls, JPEG;
- type
- TForm1 = class(TForm)
- MainMenu1: TMainMenu;
- AboutButton: TMenuItem;
- Image1: TImage;
- Timer1: TTimer;
- procedure AboutButtonClick(Sender: TObject);
- procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
- procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
- procedure Timer1Timer(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure Animate;
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- {$R *.dfm}
- var
- Form1: TForm1;
- Num: Integer;
- Flag: Boolean;
- implementation
- procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
- begin
- CanClose := MessageDlg('Вы уверены, что хотите выйти из программы?' +
- #10#13 + 'Все несохраненные данные будут утеряны.',
- mtConfirmation, [mbYes, mbNo], 0) = mrYes;
- end;
- procedure TForm1.AboutButtonClick(Sender: TObject);
- var
- Task: String;
- begin
- Task := 'Велосипедист' + #10#13;
- Task := 'По нажатию "Enter" начинает и останавливает движение' + #10#13;
- Task := Task + 'Автор - Пестунов Илья, гр. 051007';
- MessageDlg(Task, mtInformation, [mbOK], 0);
- end;
- procedure TForm1.Animate;
- var
- Path: String;
- begin
- if Flag then
- begin
- Inc(Num);
- if Num > 15 then
- Num := 0;
- Path := IntToStr(Num) + '.gif';
- Image1.Picture.LoadFromFile(Path);
- end;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- Image1.Picture.LoadFromFile('0.gif');
- Timer1.Enabled := True;
- end;
- procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- if Key = VK_RETURN then
- Flag := Not Flag;
- end;
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- Animate;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement