Wieso dafür eigentlich eine eigene Klasse? Um die Funktionlität generell zu ermöglichen, sollte doch so was ausreichen:
Delphi-Quellcode:
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure OnMove(var Msg: TWMMove); message WM_MOVE;
procedure OnMoving(var Msg: TWMMoving); message WM_MOVING;
private
{ Private declarations }
FTopLeft : TPoint;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
TForm2.Create(self).Show;
end;
procedure TForm1.OnMove(var Msg: TWMMove);
var
i : integer;
begin
inherited;
for i := 0 to Screen.FormCount -1 do
begin
if Screen.Forms[i] is TForm2 then
begin
// Differenz zwischen alter und neuer Position ebenfalls
// auf die anderen Fenster anwenden
Screen.Forms[i].Top := Screen.Forms[i].Top+Top-FTopLeft.X;
Screen.Forms[i].Left := Screen.Forms[i].Left+Left-FTopLeft.Y;
end;
end;
end;
procedure TForm1.OnMoving(var Msg: TWMMoving);
begin
// Alte Postion merken
FTopLeft := Point(Top, Left);
end;