So Geht's
Dein Komponente im protected Abschnitt
Delphi-Quellcode:
protected
.
procedure WMAreaInternalMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE;
.
Dein Komponente im Implementations-Teil
Delphi-Quellcode:
procedure TYourDesignInteractiveComponent.WMAreaInternalMouseMove(
var Message: TWMMouseMove);
begin
inherited;
if not(csNoStdEvents
in ControlStyle)
then begin
FMouseScreen.x :=
Message.XPos;
FMouseScreen.y :=
Message.YPos;
if (csDesignInteractive
in ControlStyle)
then begin
{Mach was zur Design-Time}
end
else begin
{Mach was zur Run-Time}
end;
paint;
end;
end;
und dann im Desing-Time
Package einen Component-Editor ...
Delphi-Quellcode:
interface
TYourCE = class(TDefaultEditor)
public
function GetVerb(Index:Integer):string; override;
function GetVerbCount: Integer; override;
procedure ExecuteVerb(Index: Integer); override;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Palette', [TYourDesignInteractiveComponent]);
RegisterComponentEditor(TYourDesignInteractiveComponent, TYourCE);
.
end;
function TYourCE.GetVerbCount: Integer;
begin
result := 2;
END;
function TYourCE.GetVerb(Index: Integer):STRING;
begin
case Index of
0 : result := 'DesignTime Interactive ON';
1 : result := 'DesignTime Interactive OFF';
end;
end;
procedure TYourCE.ExecuteVerb(Index: Integer);
begin
case Index of
0: begin
with TYourDesignInteractiveComponent(Component) do
begin
ControlStyle := ControlStyle+[csDesignInteractive];
end;
end;
1: begin
with TYourDesignInteractiveComponent(Component) do
begin
ControlStyle := ControlStyle-[csDesignInteractive];
end;
end;
end;
end;
.
.
end.
das wars...
Warum... Du mußt die Win-Messages direkt abfangen. Events treten zur Desing-Time nicht ein....
Edit: Falscher Fehler