Wednesday, January 7, 2009

How to Disable Maximize Button on Windows Forms using C#

Disable/Enable Maximize Box on Windows Forms


A Maximize button enables users to enlarge a window to full-screen size. To display a Maximize button, you must also set the form's FormBorderStyle property to FormBorderStyle.FixedSingle, FormBorderStyle.Sizable, FormBorderStyle.Fixed3D, or FormBorderStyle.FixedDialog.


A Maximize button automatically becomes a restore button when a window is maximized. Minimizing or restoring a window automatically changes the restore button back to a Maximize button.


To disable Maximize button


this.MaximizeBox = false;





Windows form Maximize Box

1 comments:

obitumx@yahoo.com said...

how can i disable the restore box in the following case:

frm.windowstate = formwindowstate.maximized
frm.maximizedbox = false
frm.show()

Note:
frm is an mdichild. maximizedbox/restore box resets to true after frm is shown. i don't want to use controlbox = false because i still need the minimizebox and close box.

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005