unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, StdCtrls, Buttons;
type
TForm1 =
class(TForm)
Image1: TImage;
SpeedButton1: TSpeedButton;
procedure FormKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure SpeedButton1Click(Sender: TObject);
procedure Buchstaben();
procedure Bewegen(x : integer; y : integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
dynAr :
array of string;
forDisplay :
array of string;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
case Key
of
VK_LEFT:
begin
Image1.Left := Image1.Left - 10;
key:=0;
end;
VK_RIGHT:
begin
Image1.Left := Image1.Left + 10;
key:=0;
end;
end;
end;
procedure TForm1.Buchstaben();
var
i:integer;
begin
setlength(dynAr,26);
setlength(forDisplay,6);
dynAr[0]:='
a';
dynAr[1]:='
b';
dynAr[2]:='
c';
dynAr[3]:='
d';
dynAr[4]:='
e';
dynAr[5]:='
f';
dynAr[6]:='
g';
dynAr[7]:='
h';
dynAr[8]:='
i';
dynAr[9]:='
j';
dynAr[10]:='
k';
dynAr[11]:='
l';
dynAr[12]:='
m';
dynAr[13]:='
n';
dynAr[14]:='
o';
dynAr[15]:='
p';
dynAr[16]:='
q';
dynAr[17]:='
r';
dynAr[18]:='
s';
dynAr[19]:='
t';
dynAr[20]:='
u';
dynAr[21]:='
v';
dynAr[22]:='
w';
dynAr[23]:='
x';
dynAr[24]:='
y';
dynAr[25]:='
z';
forDisplay[0]:= dynAr[random(26)];
forDisplay[1]:= dynAr[random(26)];
forDisplay[2]:= dynAr[random(26)];
forDisplay[3]:= dynAr[random(26)];
forDisplay[4]:= dynAr[random(26)];
forDisplay[5]:= dynAr[random(26)];
end;
procedure TForm1.Bewegen(x : integer; y : integer);
var
i:integer;
begin
for i := 1
to 1
do
begin
canvas.TextOut(100*i+x,-10+y,forDisplay[0]);
canvas.TextOut(100+100*i+x,-10+y,forDisplay[1]);
canvas.TextOut(200+100*i+x,-10+y,forDisplay[2]);
canvas.TextOut(300+100*i+x,-10+y,forDisplay[3]);
canvas.TextOut(400+100*i+x,-10+y,forDisplay[4]);
canvas.TextOut(500+100*i+x,-10+y,forDisplay[5]);
end;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
i :integer;
begin
Buchstaben();
for i := 0
to 300
do
begin
sleep(10);
Bewegen(0,i);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
randomize;
end;
end.