📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ExtCtrls, StdCtrls, Buttons;
type
TForm1 = class(TForm)
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Button1: TButton;
Panel1: TPanel;
Shape1: TShape;
StatusBar1: TStatusBar;
SpeedButton1: TSpeedButton;
Timer1: TTimer;
Timer2: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if button1.Tag=0 then
begin
button1.Tag:=1;
button1.Caption:='Start';
timer1.Enabled:=false;
end
else if button1.Tag=1 then
begin
button1.tag:=0;
button1.Caption:='Stop';
timer1.Enabled:=true;
end
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if speedbutton1.Tag=1 then shape1.Top:=shape1.top-1;
if shape1.top<-48 then shape1.top:=312;
if speedbutton2.Tag=1 then shape1.Top:=shape1.top+1;
if shape1.top>312 then shape1.top:=-48;
if speedbutton3.Tag=1 then shape1.left:=shape1.Left-1;
if shape1.left<-64 then shape1.Left:=608;
if speedbutton4.Tag=1 then shape1.left:=shape1.Left+1;
if shape1.left>608 then shape1.Left:=-64;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
if speedbutton1.Tag=0 then
begin
speedbutton1.tag:=1;
speedbutton2.tag:=0;
speedbutton3.tag:=0;
speedbutton4.tag:=0;
end
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
if speedbutton2.Tag=0 then
begin
speedbutton1.tag:=0;
speedbutton2.tag:=1;
speedbutton3.tag:=0;
speedbutton4.tag:=0;
end
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
if speedbutton3.Tag=0 then
begin
speedbutton1.tag:=0;
speedbutton2.tag:=0;
speedbutton3.tag:=1;
speedbutton4.tag:=0;
end
end;
procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
if speedbutton4.Tag=0 then
begin
speedbutton1.tag:=0;
speedbutton2.tag:=0;
speedbutton3.tag:=0;
speedbutton4.tag:=1;
end
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
if length(statusbar1.SimpleText)<175 then statusbar1.SimpleText:=' '+statusbar1.SimpleText;
if length(statusbar1.SimpleText)>=175 then statusbar1.SimpleText:='Welcome to visit this simple animation application';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -