on this occasion, we will try to discuss how to make animations with delphi7, namely, the banner moves to the left and right, making this animation, we just use a simple program, but, with this simple program, we can develop it into a program that is reliable , hopefully
open the Delphi application, make 'form' as shown below:
open the Delphi application, make 'form' as shown below:
on the 'object inspector', change the propert (click on the component, and then look at the object inspector)
----------------------------------------------------------------------------------------------------------------
on form.
position ---> popscreencenter
borderstyle ---> bsnone
on component
panel1
bevelliner ---> bvlowered
caption ---> kosong
label1
transparent ---> true
timer1
interval ---> 5
---------------------------------------------------------------------------------------------------------------
on 'unit.pas', add the code 'kiri: boolean;'
double click on the 'form', then copy the program in red below ..
procedure TForm1.FormCreate(Sender: TObject);
begin
kiri:=true;
end;
begin
kiri:=true;
end;
double click on component 'timer1', then copy the program in red below ..
procedure TForm1.Timer1Timer(Sender: TObject);
begin
//membuat batas arah kiri dan kanan
if label1.left <=0 then kiri:=false;
if label1.left+label1.width>panel1.width then
kiri:=true;
//membuat tulisan bergerak kiri ke kanan
if kiri=true then
label1.left:=label1.left-1
else
label1.left:=label1.left+1;
end;
end.
begin
//membuat batas arah kiri dan kanan
if label1.left <=0 then kiri:=false;
if label1.left+label1.width>panel1.width then
kiri:=true;
//membuat tulisan bergerak kiri ke kanan
if kiri=true then
label1.left:=label1.left-1
else
label1.left:=label1.left+1;
end;
end.
to try the program ... click 'run' or F9. and see the result..
if errors, usually occurs on the program,,
good luck......
if errors, usually occurs on the program,,
good luck......
No comments:
Post a Comment