Добавил:
Kaz
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:АСОИ, Delphi, много вариантов 2 сем / 1классы / грузовик самосвал / UGruz
.pas unit UGruz;
interface
Uses Graphics;
Type TGruz=class(Tobject)
x,y,r: integer;
color: Tcolor;
canvas: Tcanvas;
constructor create(x0,y0,r0: integer; color0: Tcolor; canvas0: Tcanvas);
procedure move(deltax,deltay: integer);
procedure show; virtual;
end;
implementation
Constructor TGruz.Create;
begin
inherited Create;
X:=x0;
y:=y0;
r:=r0;
Color:=Color0;
Canvas:=Canvas0;
end;
Procedure TGruz.Show;
begin
With Canvas do begin
pen.Color:=ClBlack;
Brush.Color:=color;
canvas.MoveTo(x,y-10);
canvas.LineTo(x+140,y-10);
canvas.lineto(x+140,y-60);
canvas.LineTo(x,y-60);
canvas.LineTo(x,y-10);
canvas.LineTo(x+130,y-10);
canvas.MoveTo(x,y);
canvas.LineTo(x+150,y);
x:=x+150; y:=y-60;
canvas.LineTo(x,y);
x:=x+45;
canvas.LineTo(x,y);
y:=y+45;
canvas.LineTo(x,y);
x:=x+55;
canvas.LineTo(x,y);
y:=y+40;
canvas.LineTo(x,y);
x:=x-50;
canvas.LineTo(x,y);
canvas.Ellipse(x-40,y-20,x,y+20);
canvas.moveto(x-40,y);
x:=x-130;
canvas.LineTo(x,y);
canvas.Ellipse(x-40,y-20,x,y+20);
canvas.moveto(x-40,y);
x:=x-70;
canvas.LineTo(x,y);
y:=y-25;
canvas.LineTo(x,y);
canvas.MoveTo(x+160,y-50);
canvas.LineTo(x+160,y-10);
Canvas.LineTo(x+185,y-10);
Canvas.LineTo(x+185,y-50);
Canvas.LineTo(x+160,y-50);
canvas.Brush.Color:=clRed;
canvas.FloodFill(x+10,y+20,Clred,fssurface);
end;
end;
Procedure TGruz.move;
begin
canvas.Brush.Color:=clbtnFace;
Canvas.Pen.Color:=clbTnFace;
Canvas.Rectangle(x-10,y-70,x+300,y+50);
X:=X+deltax;
Y:=y+deltaY;
Show
end;
end.
interface
Uses Graphics;
Type TGruz=class(Tobject)
x,y,r: integer;
color: Tcolor;
canvas: Tcanvas;
constructor create(x0,y0,r0: integer; color0: Tcolor; canvas0: Tcanvas);
procedure move(deltax,deltay: integer);
procedure show; virtual;
end;
implementation
Constructor TGruz.Create;
begin
inherited Create;
X:=x0;
y:=y0;
r:=r0;
Color:=Color0;
Canvas:=Canvas0;
end;
Procedure TGruz.Show;
begin
With Canvas do begin
pen.Color:=ClBlack;
Brush.Color:=color;
canvas.MoveTo(x,y-10);
canvas.LineTo(x+140,y-10);
canvas.lineto(x+140,y-60);
canvas.LineTo(x,y-60);
canvas.LineTo(x,y-10);
canvas.LineTo(x+130,y-10);
canvas.MoveTo(x,y);
canvas.LineTo(x+150,y);
x:=x+150; y:=y-60;
canvas.LineTo(x,y);
x:=x+45;
canvas.LineTo(x,y);
y:=y+45;
canvas.LineTo(x,y);
x:=x+55;
canvas.LineTo(x,y);
y:=y+40;
canvas.LineTo(x,y);
x:=x-50;
canvas.LineTo(x,y);
canvas.Ellipse(x-40,y-20,x,y+20);
canvas.moveto(x-40,y);
x:=x-130;
canvas.LineTo(x,y);
canvas.Ellipse(x-40,y-20,x,y+20);
canvas.moveto(x-40,y);
x:=x-70;
canvas.LineTo(x,y);
y:=y-25;
canvas.LineTo(x,y);
canvas.MoveTo(x+160,y-50);
canvas.LineTo(x+160,y-10);
Canvas.LineTo(x+185,y-10);
Canvas.LineTo(x+185,y-50);
Canvas.LineTo(x+160,y-50);
canvas.Brush.Color:=clRed;
canvas.FloodFill(x+10,y+20,Clred,fssurface);
end;
end;
Procedure TGruz.move;
begin
canvas.Brush.Color:=clbtnFace;
Canvas.Pen.Color:=clbTnFace;
Canvas.Rectangle(x-10,y-70,x+300,y+50);
X:=X+deltax;
Y:=y+deltaY;
Show
end;
end.
Соседние файлы в папке грузовик самосвал