uses
SysUtils, Classes, Controls, ExtCtrls, Graphics, Messages, Types;
type
TShapeType = (stRechteck, stDreieck, stProzess);
TShape1 =
class(TCustomControl)
//<-- Achtung hier TcustomControl
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;
//Die beiden Window Message Behandlungsroutinen
procedure onExit(
var msg:TMessage);
message cm_exit;
procedure onButton(
var msg:TMessage);
message wm_lbuttondown;
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;
procedure Register;
implementation
procedure TShape1.onExit(
var msg:TMessage);
begin
self.Selected := false;
end;
procedure TShape1.onButton(
var msg:TMessage);
begin
self.Selected := true;
self.SetFocus;
end;
procedure Register;
begin
RegisterComponents('
Samples', [TShape1]);
end;
procedure TShape1.SetShape(Value : TShapeType);
begin
FShape := Value;
end;
procedure TShape1.SetCaption(Value :
String);
begin
FCaption := Value;
// Paint;
end;
procedure TShape1.SetSelection(Value : Boolean);
begin
FSelected := Value;
Paint;
end;
procedure TShape1.Paint();
var sw, sh: Integer;
begin
//was hier halt so steht
end;
procedure TShape1.MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer);
begin
rx := X;
ry := Y;
oH := self.Height;
oW := self.Width;
oT := self.Top;
oL := self.Left;
// Self.Selected := True;
Paint;
end;
procedure TShape1.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
//hier rechnest du falsch, benutze evtl. mal Screentoclient
end;
procedure TShape1.MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer);
begin
end;
end.