Cari Blog Ini

Selasa, 30 November 2010

delphi Animasi ball move and stop

Created with Delphi 7 by Avid/Kira
Animasi ball move and stop

Sintak:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;

type
TForm1 = class(TForm)
Shape1: TShape;
Timer1: TTimer;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if (shape1.Top<=300) and (shape1.Left< (Form1.Width - shape1.Width)) then
begin
shape1.Top:=shape1.Top+5;
shape1.Left:=shape1.left+5;
timer1.Enabled:=true;
end
else
timer1.Enabled:=false;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
application.Terminate;
end;

end.

Tidak ada komentar:

Posting Komentar