unit ImageMovereg;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls;
var x,z:
String;
y,a:Integer;
zeit1,zeit2:longint;
type
TImageMove =
class(TImage)
private
FMoveTo:
String;
FGeschwindigkeit:longint;
FZahl1:Integer;
FZahl2:Integer;
FStatus:Boolean;
{ Private declarations }
protected
{ Protected declarations }
public
procedure Move;
{ Public declarations }
published
property Zahl1 : Integer
Read FZahl1
Write FZahl1;
property Zahl2 : Integer
Read FZahl2
Write FZahl2;
property MoveTo :
String Read FMoveTo
Write FMoveTo;
property Geschwindigkeit : longint
Read FGeschwindigkeit
Write FGeschwindigkeit;
property Status : Boolean
Read FStatus
Write FStatus;
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Eigene Komponenten', [TImageMove]);
end;
procedure TImageMove.Move;
begin
a:=0;
x:=FMoveTo;
delete(x,3,999);
z:=FMoveTo;
delete(z,1,2);
y:=StrToInt(z);
if x='
t+'
then begin
repeat
a:=a+1;
self.Top:=self.Top-1;
zeit1:=GetTickCount;
zeit2:=FGeschwindigkeit;
repeat
Application.ProcessMessages
if (GetAsyncKeyState(VK_ESCAPE))<>0
then break;
until (GetTickCount-Zeit1>zeit2);
if (GetAsyncKeyState(VK_ESCAPE))<>0
then break;
until a>=y;
end;
if x='
t-'
then begin
repeat
a:=a+1;
self.Top:=self.Top+1;
zeit1:=GetTickCount;
zeit2:=FGeschwindigkeit;
repeat
Application.ProcessMessages
if (GetAsyncKeyState(VK_ESCAPE))<>0
then break;
until (GetTickCount-Zeit1>zeit2);
if (GetAsyncKeyState(VK_ESCAPE))<>0
then break;
until a>=y;
end;
if x='
l+'
then begin
repeat
a:=a+1;
self.Left:=self.Left-1;
zeit1:=GetTickCount;
zeit2:=FGeschwindigkeit;
repeat
Application.ProcessMessages
if (GetAsyncKeyState(VK_ESCAPE))<>0
then break;
until (GetTickCount-Zeit1>zeit2);
if (GetAsyncKeyState(VK_ESCAPE))<>0
then break;
until a>=y;
end;
if x='
l-'
then begin
repeat
a:=a+1;
self.Left:=self.Left+1;
zeit1:=GetTickCount;
zeit2:=FGeschwindigkeit;
repeat
Application.ProcessMessages
if (GetAsyncKeyState(VK_ESCAPE))<>0
then break;
until (GetTickCount-Zeit1>zeit2);
if (GetAsyncKeyState(VK_ESCAPE))<>0
then break;
until a>=y;
end;
end;
end.