Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / January 2005

Tip: Looking for answers? Try searching our database.

no moving the windows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kenny M. - 20 Jan 2005 20:47 GMT
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?
WWalden - 21 Jan 2005 01:07 GMT
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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.