Click here to Skip to main content
15,891,926 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hi,
how to disable restore,minimize and maximize buttons of MDI Child forms in C# windows application?
can anyone pls help.
Posted
Updated 5-Aug-17 12:09pm

Set the form properties MinimizeBox and MaximizeBox to false.

Good luck!
 
Share this answer
 
Comments
rupalelink 9-Aug-10 7:59am    
hi..
thanks for your suggestions..i tried for it but it doesnt work..
do u have any other idea?
E.F. Nijboer 9-Aug-10 8:09am    
hmmm... a bit strange... have a look on the forms msdn pages about it:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.minimizebox.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.aspx

Maybe the formborderstyle must be changed because it's not working with all of them.
rupalelink 9-Aug-10 8:21am    
hii,
Its working in simple form but when its a child form in MDI page then its not working..
try to resolve my problem pls.
E.F. Nijboer 9-Aug-10 8:50am    
Found something like this (vb.net by the way but shouldn't be hard to translate though.
Me.FormBorderStyle =
System.Windows.Forms.FormBorderStyle.None
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.ControlBox = False
Me.WindowState =
System.Windows.Forms.FormWindowState.Maximized
E.F. Nijboer 9-Aug-10 8:57am    
Or maybe you could also try it using api calls directly:
EnableMenuItem(ChildForm.Handle, SC_MAXIMIZE, MF_DISABLED);

http://msdn.microsoft.com/en-us/library/ms647636(VS.85).aspx
In the form class's constructor, simply add the code:

this.ControlBox=false;

Or

You can use the below code while creating a new instance of form:

MyForm formObject = new MyForm();
formObject.ControlBox=false;
System.Windows.Forms.Application.Run(formObject);
 
Share this answer
 
v3
Comments
Graeme_Grant 5-Aug-17 20:52pm    
Any reason that you are answering a 7-year-old question? Do you think that he is still waiting for an answer all these years later?

Please refrain from answering old tombstoned questions and instead focus your energy on answering questions that are current where people really need help!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900