Author: Tomas Rutkauskas
How to make a form non-moveable
Answer:
It is easy to make a form non-moveable.
Choose a borderstyle like bsDialog so that the window can not be resized.
Then add an handler for the WM_WINDOWPOSCHANGING message and override the change.
1 type2 TMyForm = class(TForm)
3 protected4 procedure OnPosChange(var Msg: TWmWindowPosChanging); message5 WM_WINDOWPOSCHANGING;
6 end;
7 8 procedure TForm1.OnPosChange(var Msg: TWmWindowPosChanging);
9 begin10 Msg.WindowPos.x := Left;
11 Msg.WindowPos.y := Top;
12 Msg.Result := 0;
13 end;