Created with Delphi 7 by Avid/Kira
calculator
Sintak:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Label3: TLabel;
hasil: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
hasil.Caption:=inttostr(strtoint(edit1.text)+strtoint(edit2.Text));
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
hasil.Caption:=inttostr(strtoint(edit1.text)*strtoint(edit2.Text));
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
hasil.Caption:=floattostr(strtoint(edit1.text)/strtoint(edit2.Text));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
hasil.Caption:=inttostr(strtoint(edit1.text)-strtoint(edit2.Text));
end;
end.
Cari Blog Ini
Selasa, 30 November 2010
delphi Animasi 3 ball move
Created with Delphi 7 by Avid/Kira
Animasi 3 ball move
Sintak:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
procedure Timer1Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
atas, bawah, kiri, kanan, at, bu, kr, kn, a, b, k, r:integer;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
{shape1}
if (atas=1) then
shape1.top:=shape1.Top-1;
if (bawah=1) then
shape1.Top:=shape1.Top+1;
if (kanan=1) then
shape1.left:=shape1.Left+1;
if (kiri=1) then
shape1.Left:=shape1.Left-1;
if (shape1.left>390) then
begin
kiri:=1;
kanan:=0;
end;
if (shape1.left<=0) then
begin
kanan:=1;
kiri:=0;
end;
if (shape1.top<=0) then
begin
atas:=0;
bawah:=1;
end;
if (shape1.top>370) then
begin
atas:=1;
bawah:=0;
end;
{shape2}
if (at=1) then
shape2.Top:=shape2.Top-1;
if (bu=1) then
shape2.Top:=shape2.Top+1;
if (kn=1) then
shape2.Left:=shape2.Left+1;
if (kr=1) then
shape2.Left:=shape2.Left-1;
if (shape2.left>390) then
begin
kr:=1;
kn:=0;
end;
if (shape2.left<=0) then
begin
kn:=1;
kr:=0;
end;
if (shape2.top<=0) then
begin
at:=0;
bu:=1;
end;
if (shape2.top>370) then
begin
at:=1;
bu:=0;
end;
{shape3}
if (a=1) then
shape3.Top:=shape3.Top-1;
if (b=1) then
shape3.Top:=shape3.Top+1;
if (k=1) then
shape3.Left:=shape3.Left+1;
if (r=1) then
shape3.Left:=shape3.Left-1;
if (shape3.left>390) then
begin
r:=1;
k:=0;
end;
if (shape3.left<=0) then
begin
k:=1;
r:=0;
end;
if (shape3.top<=0) then
begin
a:=0;
b:=1;
end;
if (shape3.top>370) then
begin
a:=1;
b:=0;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
application.Terminate;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
timer1.Enabled:=true;
{shape1}
kanan:=1;bawah:=1;
{shape2}
kr:=1;at:=1;
{shape3}
k:=1;a:=1;
end;
end.
delphi Animasi 2 ball move
Animasi 2 ball move
Sintak:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Shape1: TShape;
Shape2: TShape;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
atas, bawah, kiri, kanan, at, bu, kr, kn:integer;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
{shape1}
if (atas=1) then
shape1.top:=shape1.Top-1;
if (bawah=1) then
shape1.Top:=shape1.Top+1;
if (kanan=1) then
shape1.left:=shape1.Left+1;
if (kiri=1) then
shape1.Left:=shape1.Left-1;
if (shape1.left>390) then
begin
kiri:=1;
kanan:=0;
end;
if (shape1.left<=0) then
begin
kanan:=1;
kiri:=0;
end;
if (shape1.top<=0) then
begin
atas:=0;
bawah:=1;
end;
if (shape1.top>370) then
begin
atas:=1;
bawah:=0;
end;
{shape2}
if (at=1) then
shape2.Top:=shape2.Top-1;
if (bu=1) then
shape2.Top:=shape2.Top+1;
if (kn=1) then
shape2.Left:=shape2.Left+1;
if (kr=1) then
shape2.Left:=shape2.Left-1;
if (shape2.left>390) then
begin
kr:=1;
kn:=0;
end;
if (shape2.left<=0) then
begin
kn:=1;
kr:=0;
end;
if (shape2.top<=0) then
begin
at:=0;
bu:=1;
end;
if (shape2.top>370) then
begin
at:=1;
bu:=0;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
application.Terminate;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
timer1.Enabled:=true;
{shape1}
kanan:=1;bawah:=1;
{shape2}
kr:=1;at:=1;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
application.terminate;
end;
end.
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.
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.
Langganan:
Postingan (Atom)



