Скачиваний:
10
Добавлен:
15.06.2014
Размер:
1.44 Кб
Скачать
unit Unit2;

interface

uses graphics;
var colrBack : TColor;
Type
TParClass = class (TObject)
colrLine : TColor;
Canvas : TCanvas;
x,y,r: Word;
procedure Ris; Virtual; abstract;
procedure Draw(bl:Boolean);
Procedure Show;
Procedure Hide;
Procedure MoveTo(dx,dy:integer);
end;

TRectangle = class(TParClass)
x1: word;
y1: word;
x2: word;
y2: word;
Constructor create(x0,y0,r0:word;ColrLine0 : TColor; Canvas0 : TCanvas);
Procedure Ris; override;
end;
TCircle = class(TRectangle)
Procedure Ris; Override;
end;


implementation

Procedure TParClass.Draw;
begin
With Canvas do
begin
if bl then
begin
pen.color:=ColrLine;
Brush.color:=ColrLine
end
else
begin
pen.color:=ColrBack;
Brush.color:=ColrBack
end;
Ris;
end;
end;

Procedure TParClass.show;
begin
Draw(True)
end;

Procedure TParClass.Hide;
begin
draw(false)
end;

Procedure TParClass.MoveTo;
begin
Hide ;
x:=X+dx; y:=y+dy;
show
end;

Constructor TRectangle.Create;
begin
ColrLine:=ColrLine0;
canvas:=canvas0;
x:=x0; y:=y0; r:=r0
end;

Procedure TCircle.Ris;
begin
x1:=x-r; x2:=x+r; y1:=y-r; y2:=y+r;
Canvas.Ellipse(x1,y1,x2,y2)
end;

Procedure TRectangle.ris;
begin
x1:=x-100; y1:=y-25; x2:=x+100; y2:=y+25;
canvas.Rectangle(x1,y1,x2,y2)
end;

end.
Соседние файлы в папке летающий синий шарик