We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to prevent a form from moving

Thread ID:

Created:

Updated:

Platform:

Replies:

7030 Sep 10,2003 05:00 AM Sep 11,2003 06:16 AM Windows Forms 2
loading
Tags: FAQ
Steve
Asked On September 10, 2003 05:00 AM

Hi, I would like that my form inherit from Form (which has this.ControlBox = false; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; ) would not allow moving. I have try to override OnMove, but I do not achieve my aim, I guess it just do not call the associate delegate. Any help is welcome, thank you

Administrator [Syncfusion]
Replied On September 10, 2003 03:49 PM

Hi Steve, This is not exactly a solution, but you can try setting the FormBorderStyle to "None". This prevents the user from moving the form. Regards, Br. > > Hi, > > I would like that my form inherit from Form (which has > this.ControlBox = false; > this.FormBorderStyle = FormBorderStyle.FixedToolWindow; > ) would not allow moving. > I have try to override OnMove, but I do not achieve my aim, I guess it just do not call the associate delegate. > > Any help is welcome, > > thank you >

Steve
Replied On September 11, 2003 06:16 AM

I have found a better solution : http://groups.google.de/groups?selm=u1eMJOibDHA.2632%40TK2MSFTNGP09.phx.gbl in VB and I implemented it like this in c#: protected override void WndProc(ref Message m) { const int WM_NCLBUTTONDOWN = 161; const int WM_SYSCOMMAND = 274; const int HTCAPTION = 2; const int SC_MOVE = 61456; if((m.Msg == WM_SYSCOMMAND) && (m.WParam.ToInt32() == SC_MOVE)) { return; } if((m.Msg == WM_NCLBUTTONDOWN) && (m.WParam.ToInt32() == HTCAPTION)) { return; } base.WndProc (ref m); } > Hi Steve, > This is not exactly a solution, but you can try setting the FormBorderStyle to "None". This prevents the user from moving the form. > > Regards, > > Br. > > > > Hi, > > > > I would like that my form inherit from Form (which has > > this.ControlBox = false; > > this.FormBorderStyle = FormBorderStyle.FixedToolWindow; > > ) would not allow moving. > > I have try to override OnMove, but I do not achieve my aim, I guess it just do not call the associate delegate. > > > > Any help is welcome, > > > > thank you > > >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;