Did you need to show the caption bar? If not, you can set ControlBox to false
and clear the Text property of the form to get rid of the caption box. Then
they have no way to move the form.
or....
If you need to show the caption bar, you could try this:
1.) Create a new class that inherits from the base Form class.
2.) Set the ControlBox property to false (but do not clear the Text property
- set it to whatever you want).
3.) Override WndProc and filter WM_NCHITTEST messages. Ex:
private const int WM_NCHITTEST = 0x84;
protected override void WndProc(ref Message m) {
if (m.Msg == WM_NCHITTEST) return;
base.WndProc (ref m);
}
The possible downside to this approach is this also prevents them from
minimizing, maximizing, closing, etc.. You would have to offer other means to
perform those functions.
> I have a modal winform centered in the middle of the screen and I dont want
> people to move the window using the mouse.
>
> Is there an easy way?
joeycalisay - 21 Jan 2005 02:41 GMT
From Google Groups:
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.windowsfor
ms/browse_thread/thread/b7b7be6feb85b375/b903320733be0280?q=prevent+move&_done=%
2Fgroup%2Fmicrosoft.public.dotnet.framework.windowsforms%2Fsearch%3Fq%3Dprevent+
move%26start%3D20%26&_doneTitle=Back+to+Search&&d#b903320733be0280

Signature
Joey Calisay
http://spaces.msn.com/members/joeycalisay/
> Did you need to show the caption bar? If not, you can set ControlBox to false
> and clear the Text property of the form to get rid of the caption box. Then
[quoted text clipped - 23 lines]
> >
> > Is there an easy way?