I have a borderless form that is movable by mouse-grabbing a panel.
Relevant code here:
var
MPos: Tpoint;
{ If mouse clicks on the top bar, grab the mouse position... }
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
MPos.X := X;
MPos.Y := Y;
end;
{ ... and if mouse moves while clicked on the top, change the co-ords of the
Window to follow mouse. This way we can move the window without a title bar. }
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if ssLeft in Shift then
SetBounds(Left + (X - MPos.X), Top + (Y - MPos.Y), Width, Height);
end;
In Windows, Qt 32 and 64 bit, and 64 bit GTK2, the window move smoothly as you drag it. In 32-bit GTK2 specifically, moving the window with the mouse causes the window to jump around the desktop spasmodically, sometimes ending up off the screen with just a corner showing.
Any ideas?