You are on page 1of 7

TUGAS 2

procedure TForm1.TrackBar1Change(Sender: TObject);

begin

if TrackBar1.Position=0 then

shape1.Shape:=strectangle

else if TrackBar1.Position=1 then

shape1.Shape:=stcircle

else if TrackBar1.Position=2 then

shape1.Shape:=stellipse

else if TrackBar1.Position=3 then

shape1.Shape:=stroundrect

else if TrackBar1.Position=4 then

shape1.Shape:=stroundsquare

else if TrackBar1.Position=5 then

shape1.Shape:=stsquare

end;

end.

procedure TForm1.TrackBar2Change(Sender: TObject);

begin

if TrackBar2.Position=0 then

shape1.Brush.Style:= bsBDiagonal

else if TrackBar2.Position=1 then

shape1.Brush.Style:= bsClear

else if TrackBar2.Position=2 then

shape1.Brush.Style:= bscross

else if TrackBar2.Position=3 then


shape1.Brush.Style:= bsdiagcross

else if TrackBar2.Position=4 then

shape1.Brush.Style:= bshorizontal

else if TrackBar2.Position=5 then

shape1.Brush.Style:= bssolid

else if TrackBar2.Position=6 then

shape1.Brush.Style:= bsvertical

end;

procedure TForm1.TrackBar3Change(Sender: TObject);

begin

if TrackBar3.Position=0 then

shape1.Brush.Color:=clred

else if TrackBar3.Position=1 then

shape1.Brush.Color:=clblue

else if TrackBar3.Position=2 then

shape1.Brush.Color:=clyellow

else if TrackBar3.Position=3 then

shape1.Brush.Color:=clgreen

else if TrackBar3.Position=4 then

shape1.Brush.Color:=clwhite

else if TrackBar3.Position=5 then

shape1.Brush.Color:=clblack

end;

end;

end.
TUGAS 1

procedure TForm1.FormCreate(Sender: TObject);

begin

Timer1.Interval:=500;

Timer1.Enabled:=False;

Button1.caption:='Mulai';

Form1.Caption:='Latihan Delphi';

end;

procedure TForm1.Timer1Timer(Sender: TObject);

var jumchar:integer;

begin

jumchar:= length(form1.caption);

case jumchar of

1: form1.caption:= form1.caption+'a';

2: form1.caption:= form1.caption+'t';

3: form1.caption:= form1.caption+'i';

4: form1.caption:= form1.caption+'h';

5: form1.caption:= form1.caption+'a';

6: form1.caption:= form1.caption+'n';

7: form1.caption:= form1.caption+' ';

8: form1.caption:= form1.caption+'D';

9: form1.caption:= form1.caption+'e';

10: form1.caption:= form1.caption+'l';

11: form1.caption:= form1.caption+'p';

12: form1.caption:= form1.caption+'h';


13: form1.caption:= form1.caption+'i';

14: form1.caption:= 'L' ;

end;

end;

procedure TForm1.Label1Click(Sender: TObject);

begin

timer2.Interval:=500;

timer2.Enabled:=false;

label1.Caption:='contoh program animasi';

button1.Caption:='mulai';

end;

procedure TForm1.Timer2Timer(Sender: TObject);

var jumchar:integer;

begin

jumchar:= length(label1.caption);

case jumchar of

1: Label1.caption:= Label1.caption+'o';

2: Label1.caption:= Label1.caption+'n';

3: Label1.caption:= Label1.caption+'t';

4: Label1.caption:= Label1.caption+'o';

5: Label1.caption:= Label1.caption+'h';

6: Label1.caption:= Label1.caption+' ';


7: Label1.caption:= Label1.caption+'p';

8: Label1.caption:= Label1.caption+'r';

9: Label1.caption:= Label1.caption+'o';

10: Label1.caption:= Label1.caption+'g';

11: Label1.caption:= Label1.caption+'r';

12: Label1.caption:= Label1.caption+'a';

13: Label1.caption:= Label1.caption+'m';

14: Label1.caption:= Label1.caption+' ';

15: Label1.caption:= Label1.caption+'a';

16: Label1.caption:= Label1.caption+'n';

17: Label1.caption:= Label1.caption+'i';

18: Label1.caption:= Label1.caption+'m';

19: Label1.caption:= Label1.caption+'a';

20: Label1.caption:= Label1.caption+'s';

21: Label1.caption:= Label1.caption+'i';

22: Label1.caption:= 'C';

end;

end;

procedure TForm1.Edit1Change(Sender: TObject);

begin

timer3.Interval:=500;

timer3.Enabled:=false;

edit1.text:='Animasi Dengan Delphi';

button1.Caption:='mulai';

end;
procedure TForm1.Timer3Timer(Sender: TObject);

var jumchar:integer;

begin

jumchar:= length(Edit1.text);

case jumchar of

1: Edit1.text:= Edit1.text+'n';

2: Edit1.text:= Edit1.text+'i';

3: Edit1.text:= Edit1.text+'m';

4: Edit1.text:= Edit1.text+'a';

5: Edit1.text:= Edit1.text+'s';

6: Edit1.text:= Edit1.text+'i';

7: Edit1.text:= Edit1.text+' ';

8: Edit1.text:= Edit1.text+'d';

9: Edit1.text:= Edit1.text+'e';

10: Edit1.text:= Edit1.text+'n';

11: Edit1.text:= Edit1.text+'g';

12: Edit1.text:= Edit1.text+'a';

13: Edit1.text:= Edit1.text+'n';

14: Edit1.text:= Edit1.text+' ';

15: Edit1.text:= Edit1.text+'d';

16: Edit1.text:= Edit1.text+'e';

17: Edit1.text:= Edit1.text+'l';

18: Edit1.text:= Edit1.text+'p';

19: Edit1.text:= Edit1.text+'h';

20: Edit1.text:= Edit1.text+'i';

21: Edit1.text:= 'A';


end;

end;

end.

You might also like