unit muodot; interface uses extctrls,controls,Classes; type TFigure = class(TPaintBox) private Fx: double; Fy: double; Fw: double; Fh: double; procedure Seth(const Value: double); virtual; procedure Setw(const Value: double); virtual; procedure Setx(const Value: double); virtual; procedure Sety(const Value: double); virtual; public procedure zoom(f:double); virtual; procedure move(f:double); virtual; published property x : double read Fx write Setx; property y : double read Fy write Sety; property h : double read Fh write Seth; property w : double read Fw write Setw; end; TKolmio = class(TFigure) public procedure Paint; override; end; TNelio = class(TFigure) public procedure Paint; override; end; TAlusta = class(TPanel) public procedure zoom(f:double); virtual; end; TOrsi = class(TPanel) public procedure Monista(par:TWinControl;x,y:integer; f:TFigure); end; procedure Register; implementation { TFigure } procedure Register; begin RegisterComponents('GKO99', [TKolmio,TNelio,TAlusta,TOrsi]); end; procedure TFigure.move(f: double); begin x := x * f; y := y * f; end; procedure TFigure.Seth(const Value: double); begin Fh := Value; Height := Round(h); y := y; end; procedure TFigure.Setw(const Value: double); begin Fw := Value; Width := Round(w); x := x; end; procedure TFigure.Setx(const Value: double); begin Fx := Value; Left := Round(x-w/2); end; procedure TFigure.Sety(const Value: double); begin Fy := Value; Top := Round(y-h/2); end; procedure TFigure.zoom(f: double); begin h := h * f; w := w * f; end; { TKolmio } procedure TKolmio.Paint; begin inherited; Canvas.MoveTo(0,Height-1); Canvas.LineTo(Width-1,Height-1); Canvas.LineTo(Width div 2,0); Canvas.LineTo(0,Height-1); end; { TNelio } procedure TNelio.Paint; begin inherited; Canvas.Rectangle(0,0,Width-1,Height-1); end; { TAlusta } procedure TAlusta.zoom(f: double); var i:integer; c : TControl; fig : TFigure; begin for i:= 0 to ControlCount-1 do begin c := Controls[i]; if not ( c is TFigure ) then continue; fig := TFigure(c); fig.move(f); fig.zoom(f); end; end; { TOrsi } procedure TOrsi.Monista(par:TWinControl;x, y: integer; f: TFigure); var uusi : TFigure; begin uusi := TFigure(f.NewInstance); uusi.Create(par); uusi.Parent := par; uusi.x := x; uusi.y := y; end; end.