63 lines
954 B
ObjectPascal
63 lines
954 B
ObjectPascal
|
unit drawingdisplay;
|
||
|
|
||
|
{$mode objfpc}{$H+}
|
||
|
|
||
|
interface
|
||
|
|
||
|
uses
|
||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, drawing;
|
||
|
type
|
||
|
{ TForm1 }
|
||
|
TForm1 = class(TForm)
|
||
|
procedure FormCreate(Sender: TObject);
|
||
|
procedure rgShapeClick(Sender: TObject);
|
||
|
private
|
||
|
rgShape: TRadioGroup;
|
||
|
FDrawing: TDrawing;
|
||
|
procedure CreateANewDrawing;
|
||
|
public
|
||
|
end;
|
||
|
|
||
|
const extent = 50;
|
||
|
|
||
|
var
|
||
|
Form1: TForm1;
|
||
|
|
||
|
implementation
|
||
|
|
||
|
procedure TForm1.CreateANewDrawing;
|
||
|
begin
|
||
|
if (rgShape.ItemIndex < 0) then Exit;
|
||
|
|
||
|
FDrawing.Free;
|
||
|
|
||
|
case rgShape.ItemIndex of
|
||
|
0: begin
|
||
|
FDrawing := TSquare.Create(Self, extent);
|
||
|
FDrawing.Left := 10;
|
||
|
end;
|
||
|
1: begin
|
||
|
FDrawing := TCircle.Create(Self, extent);
|
||
|
FDrawing.Left := 60;
|
||
|
end;
|
||
|
end;
|
||
|
|
||
|
FDrawing.Top := 10;
|
||
|
FDrawing.Parent := Self;
|
||
|
end;
|
||
|
|
||
|
procedure TForm1.FormCreate(Sender: TObject);
|
||
|
begin
|
||
|
CreateANewDrawing;
|
||
|
end;
|
||
|
|
||
|
procedure TForm1.rgShapeClick(Sender: TObject);
|
||
|
begin
|
||
|
CreateANewDrawing;
|
||
|
end;
|
||
|
|
||
|
{$R *.lfm}
|
||
|
|
||
|
end.
|
||
|
|