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;
- 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
- Inc(Num);
- if Num > 15 then
- Num := 0;
- Path := IntToStr(Num) + '.gif';
- Image1.Picture.LoadFromFile(Path);
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- Image1.Picture.LoadFromFile('0.gif');
- end;
- procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- if Key = VK_RETURN then
- Timer1.Enabled := Not Timer1.Enabled;
- end;
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- Animate;
- end;
- end.
Add Comment
Please, Sign In to add comment