есть код проги... она не консольная... но самой проги (рабочего проекта) нету... Вот надо востановить по коду всё визуальщину... Вознаграждение гарантируется :)
Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
x,b,rad,shapetop,shapewidth,shapeheight,shapeleft:Word;
dy,ay,y:real;
t:real;
bmp:Tbitmap;
r:Trect;
const
g=9.81;
m=0.01;
k=0.00000000184;
implementation
{$R *.dfm}
procedure Ris;
begin
form1.Canvas.pen.Style:=psclear;
if round(y)>shapetop+Rad then
begin
form1.Canvas.brush.color:=$ffbb77;
form1.Canvas.rectangle(x-1,round(y),x+rad+1,round(y)+rad);
end
else
begin
form1.Canvas.brush.color:=clbtnface;
form1.Canvas.Rectangle(x-1,shapetop-1,x+1+rad,shapetop+Rad);
form1.Canvas.brush.color:=$ffbb77;
form1.Canvas.Rectangle(x-1,shapetop+Rad-1,x+1+rad,shapetop+2*Rad+1);
end;
form1.Canvas.brush.color:=clblack;
y:=y+dy*sqr(t)/2;
if round(y)+rad>shapetop+shapeheight then
begin
form1.Canvas.ellipse(x,shapetop+shapeheight-rad,x+rad,shapetop+shapeheight);
exit;
end;
form1.Canvas.brush.color:=clblack;
form1.Canvas.ellipse(x,round(y),x+rad,round(y)+rad);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
t:=t+0.06;
Label1.Caption:=FloatToStr(t);
label2.Caption:=floattostr(dy);
if round(y)>shapeHeight+Shapetop-32
then
begin
timer1.Enabled:=false;
bitbtn1.Caption:='Запуск';
exit;
end;
Ris;
dy:=(dy+g*exp(-k*t/m))/2;
Chart1.Series[0].Add(y,FloatToStr(t),clRed);
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
rad:=30;
x:=shapeleft+(Shapewidth - Rad) div 2;
y:=Shapetop;
dy:=1;
ay:=2;
t:=0;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Chart1.Series[0].Clear;
if timer1.Enabled then
begin
bitbtn1.Caption:='Запуск';
timer1.Enabled:=false;
end
else
begin
Canvas.CopyRect(r,bmp.Canvas,bmp.Canvas.ClipRect);
formactivate(sender);
timer1.enabled:=true;
bitbtn1.Caption:='Стоп';
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if MessageDlg('Вы действительно хотите выйти из программы',MtInformation,[mbOk,mbCancel],0)=mrok then
Form1.Close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
shapetop:=34;
shapewidth:=100;
shapeheight:=400;
shapeleft:=50;
end;
procedure TForm1.FormPaint(Sender: TObject);
var i:Word;
begin
if timer1.tag=0 then
begin
form1.timer1.enabled:=false;
timer1.Tag:=1;
with canvas do
begin
brush.Color:=$ffbb77;
pen.width:=2;
roundrect(shapeleft,shapetop,shapeleft+shapewidth,shapetop+shapeheight,shapewidth div 4,shapewidth div 4);
brush.Color:=clbtnface;
pen.Style:=psclear;
Rectangle(shapeleft,shapetop-1,shapeleft+shapewidth,shapetop+Rad);
pen.Style:=pssolid;
moveto(shapeleft,shapetop);
Lineto(shapeleft,shapetop+Rad);
moveto(shapeleft-1+shapewidth,shapetop);
Lineto(shapeleft-1+shapewidth,shapetop+Rad);
brush.color:=clblack;
i:=1;
while shapetop+shapeheight-i*40>shapetop do
begin
moveto(shapeleft-1+shapewidth,shapetop+shapeheight-i*40);
Lineto(shapeleft-10+shapewidth,shapetop+shapeheight-i*40);
inc(i)
end;
end;
bmp:=Tbitmap.Create;
bmp.Height:=shapeheight+1;
bmp.width:=shapewidth+1;
r.Left:=shapeleft-1;
r.top:=shapetop-1;
r.right:=shapewidth+shapeleft;
r.bottom:=shapeheight+shapetop;
Bmp.Canvas.CopyRect(Bmp.Canvas.ClipRect,Canvas, r);
Canvas.ellipse(x,round(y),x+30,round(y)+30);
end
else
begin
Canvas.CopyRect(r,bmp.Canvas,bmp.Canvas.ClipRect);
// ris
end
end;
Ответить
|