C# Maximized Forms Are Still Movable And resizeable

Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2009
Posts: 2
Reputation: briantrumpet is an unknown quantity at this point 
Solved Threads: 0
briantrumpet briantrumpet is offline Offline
Newbie Poster

C# Maximized Forms Are Still Movable And resizeable

 
0
  #1
Nov 9th, 2009
How do you stop forms from being movable and resizeable after you have maximized them in code.(this only happens if the maximize box is disabled)

If you maximize a form with the maximize button it does not let you move or resize the form.
Last edited by briantrumpet; Nov 9th, 2009 at 1:43 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,464
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 629
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast
 
0
  #2
Nov 9th, 2009
How are you maximizing the form in code and how are you disabling the maximimize box? If you set the height and width to the entire screen then it is not truly maximized and it will let you move and resize the form. If you send it a maximize window message then it won't. This is how you should maximize it:
  1. private void frmMaximize_Load(object sender, EventArgs e)
  2. {
  3. this.WindowState = FormWindowState.Maximized;
  4. }

You can also toggle between maximized and normal state by double clicking on the form's header and right clicking on the item in the windows task bar -- unless you have disabled those too.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 2
Reputation: briantrumpet is an unknown quantity at this point 
Solved Threads: 0
briantrumpet briantrumpet is offline Offline
Newbie Poster
 
0
  #3
Nov 9th, 2009
Originally Posted by sknake View Post
How are you maximizing the form in code and how are you disabling the maximimize box? If you set the height and width to the entire screen then it is not truly maximized and it will let you move and resize the form. If you send it a maximize window message then it won't. This is how you should maximize it:
  1. private void frmMaximize_Load(object sender, EventArgs e)
  2. {
  3. this.WindowState = FormWindowState.Maximized;
  4. }

You can also toggle between maximized and normal state by double clicking on the form's header and right clicking on the item in the windows task bar -- unless you have disabled those too.
this is how I maximize my form
  1. this.WindowState = FormWindowState.Maximized;
this.WindowState = FormWindowState.Maximized;
It will still allow me to move and resize my form if the maximize box in the task bar is set to disabled.
If the maximize box in the task bar is set to enabled and I maximize my form with the code I cannot move the form.

Any ideas to why this works this way??
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 972
Reputation: DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough 
Solved Threads: 213
DdoubleD DdoubleD is offline Offline
Posting Shark
 
0
  #4
Nov 9th, 2009
Setting the form's property this.MaximizeBox = false; prevents the form from being maximized as far as I can tell. Are you saying this is not so in your case?

Setting the form's property this.FormBorderStyle to one of the fixed border styles will prevent it from being sizeable (eg. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; . See FormBorderStyle...

As far as moving the form when maximized, you should not be able to do this, which also relates to your question: "Any ideas to why this works this way?" Maximized form fills the screen, though I don't know how this relates to virtual screens...
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 372 | Replies: 3
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC