цикл возникает при двойном щелчке по форме
Код
constructor bol.createe(sx,sy:integer;box:tPaintBox);
begin
currX:=sX;
currY:=sY;
destX:=sX;
destY:=sY;
deltaX:=0;
deltaY:=0;
shar(box,sx,sy);
end;
procedure bol.shar(box:tPaintBox;sdx,sdy:integer);
var key, x,y:integer;
begin
Box.Canvas.Pen.Width:=3;
Box.Canvas.Pen.Color:=clred;
Box.canvas.ellipse(currX-25,currY-25,currX+25,currY+25);
Box.canvas.font.name:='Arial';
Box.canvas.font.style:=[fsBold,fsItalic];
Box.canvas.font.size:=50 div 5;
x:=sdx -25+(50 - Box.canvas.textwidth('sony'))div 2;
y:=sdy -25+(50 - Box.canvas.textheight('sony'))div 2;
Box.canvas.textout(x,y,'sony'); Box.Canvas.Pen.Color:=clBtnFace;
end;
procedure bol.del(box:tPaintBox);
begin
Box.Canvas.Pen.Width:=3;
Box.Canvas.Pen.Color:=clBtnFace;
Box.canvas.ellipse(currX-25,currY-25,currX+25,currY+25);
end;
procedure bol.run0(box:tPaintBox);
begin
while (curry-25)<>0 do begin
time;
del(box);
currx:=currx+1;
curry:=curry-1;
shar(box,currx,curry);
end;
run1(box);
end;
procedure bol.time;
var t:integer;
begin
t:=5000000;
while t<>0 do t:=t-1;
end;
procedure bol.run1(box:tPaintBox);
begin
while ((currx+25)<609) and ((curry+25)<609) and ((currx-25)>0) do begin
time;
del(box);
currx:=currx+1;
curry:=curry+1;
shar(box,currx,curry);
end;
if (currx+25)>608 then run2(box);
if (curry+25)>608 then run3(box);
if (currx-25)<1 then run4(box);
end;
procedure bol.run2(box:tPaintBox);
begin
while ((curry-25)>0) and ((curry+25)<609) and ((currx-25)>0) do begin
time;
del(box);
currx:=currx-1;
curry:=curry+1;
shar(box,currx,curry);
end;
if (curry-25)<1 then run1(box);
if (curry+25)>608 then run3(box);
if (currx-25)<1 then run4(box);
end;
procedure bol.run3(box:tPaintBox);
begin
while ((curry-25)>0) and ((currx+25)<609) and ((currx-25)>0) do begin
time;
del(box);
currx:=currx-1;
curry:=curry-1;
shar(box,currx,curry);
end;
if (curry-25)<1 then run1(box);
if (currx+25)>608 then run2(box);
if (currx-25)<1 then run4(box);
end;
procedure bol.run4(box:tPaintBox);
begin
while ((curry-25)>0) and ((currx+25)>0) and ((curry+25)>0) do begin
time;
del(box);
currx:=currx+1;
curry:=curry-1;
shar(box,currx,curry);
end;
if (curry-25)<1 then run1(box);
if (currx+25)>608 then run2(box);
if (curry+25)>608 then run3(box);
end;