procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
StaticText1.caption := format('%d,%d', [x,y]);
StaticText1.Color := clWindow;
if x + 30 + StaticText1.Width > Width then
StaticText1.left:= Width - StaticText1.Width - 10
else
StaticText1.left:= x+20;
if y + 40 + StaticText1.Height > Height then
StaticText1.Top := Height - StaticText1.Height - 40
else
StaticText1.top:= y+20;
StaticText1.BringToFront;
StaticText1.Refresh;
end;