interface
uses
SysUtils, Classes, Controls, ExtCtrls, Graphics, Messages;
type
TShapeType = (stRechteck, stDreieck, stProzess);
TShape1 =
class(TShape)
private
{ Private declarations }
FShape : TShapeType;
FCaption :
String;
FSelected : Boolean;
rx, ry,
oH, oW,
oL,
oT : Integer;
procedure SetShape(Value : TShapeType);
procedure SetCaption(Value :
String);
procedure SetSelection(Value : Boolean);
protected
{ Protected declarations }
protected procedure Paint();
override;
protected procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer);
override;
protected procedure MouseMove(Shift: TShiftState; X, Y: Integer);
override;
protected procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer);
override;
public
{ Public declarations }
published
{ Published declarations }
property Shape: TShapeType
read FShape
write SetShape;
property Caption:
String read FCaption
write SetCaption;
property Selected: Boolean
read FSelected
write SetSelection;
end;
type TMyShape =
class(TWinControl)
Shape : TShape1;
procedure Exit(
var msg:TMessage);
message cm_exit;
procedure Button(
var msg:TMessage);
message wm_lbuttondown;
constructor create(Aowner:Tcomponent);
override;
destructor destroy;
end;
procedure Register;
implementation
constructor TMyShape.create;
begin
inherited create(Aowner);
shape:=Tshape1.Create(self);
shape.Parent:=self;
shape.Enabled:=false;
self.TabStop:=true;
end;
destructor TMyShape.destroy;
begin
shape.Free;
inherited;
end;
procedure TMyShape.Exit(
var msg:TMessage);
begin
self.Shape.Selected := false;
end;
procedure TMyShape.Button(
var msg:TMessage);
begin
self.Shape.Selected := true;
end;