Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
77
Task/Animation/Pascal/animation.pas
Normal file
77
Task/Animation/Pascal/animation.pas
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
program HelloWorldAnimatedGUI;
|
||||
|
||||
uses {$IFDEF UNIX} {$IFDEF UseCThreads}
|
||||
cthreads, {$ENDIF} {$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms,
|
||||
Classes,
|
||||
Controls,
|
||||
StdCtrls,
|
||||
ExtCtrls;
|
||||
|
||||
type
|
||||
{ TFrmHelloWorldAnim }
|
||||
TFrmHelloWorldAnim = class(TForm)
|
||||
constructor CreateNew(AOwner: TComponent; Num: integer = 0); override;
|
||||
procedure lblTextAnimateClick(Sender: TObject);
|
||||
procedure tmrAnimateTimer(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
lblTextAnimate: TLabel;
|
||||
tmrAnimate: TTimer;
|
||||
FDirection: boolean;
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
FrmHelloWorldAnim: TFrmHelloWorldAnim;
|
||||
|
||||
{ TFrmHelloWorldAnim }
|
||||
|
||||
constructor TFrmHelloWorldAnim.CreateNew(AOwner: TComponent; Num: integer);
|
||||
begin
|
||||
inherited CreateNew(AOwner, Num);
|
||||
Height := 50;
|
||||
lblTextAnimate := TLabel.Create(self);
|
||||
with lblTextAnimate do
|
||||
begin
|
||||
Caption := 'Hello World! ';
|
||||
Align := alClient;
|
||||
Alignment := taCenter;
|
||||
font.Name := 'Courier New';
|
||||
font.size := 20;
|
||||
OnClick := @lblTextAnimateClick;
|
||||
Parent := self;
|
||||
end;
|
||||
tmrAnimate := TTimer.Create(self);
|
||||
with tmrAnimate do
|
||||
begin
|
||||
Interval := 100;
|
||||
OnTimer := @tmrAnimateTimer;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFrmHelloWorldAnim.lblTextAnimateClick(Sender: TObject);
|
||||
begin
|
||||
FDirection := not FDirection;
|
||||
end;
|
||||
|
||||
procedure TFrmHelloWorldAnim.tmrAnimateTimer(Sender: TObject);
|
||||
begin
|
||||
if FDirection then
|
||||
lblTextAnimate.Caption :=
|
||||
copy(lblTextAnimate.Caption, length(lblTextAnimate.Caption), 1) +
|
||||
copy(lblTextAnimate.Caption, 1, length(lblTextAnimate.Caption) - 1)
|
||||
else
|
||||
lblTextAnimate.Caption :=
|
||||
copy(lblTextAnimate.Caption, 2, length(lblTextAnimate.Caption) - 1) +
|
||||
copy(lblTextAnimate.Caption, 1, 1);
|
||||
end;
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := False;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TFrmHelloWorldAnim, FrmHelloWorldAnim);
|
||||
Application.Run;
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue