Disable maximizing and minimizing of windows form

8

I need a solution to disable the maximize and minimize buttons in a windows form. Using WPF these two attributes would solve:

WindowStartupLocation="CenterScreen"
ResizeMode="NoResize"

But now I need it to be in a windows form. Here is the image below of how it came to form in WPF.

    
asked by anonymous 14.04.2015 / 15:19

3 answers

6

Use the following Form properties:

form1.FormBorderStyle = FormBorderStyle.FixedSingle;
form1.MaximizeBox = false;
form1.MinimizeBox = false;  

form1.FormBorderStyle = FormBorderStyle.FixedSingle; is required to prevent the window from being resized with the mouse by dragging the border.

    
14.04.2015 / 15:27
6

The form has two properties that call MaximizeBox and MinimizeBox, just go to false:

    
14.04.2015 / 15:23
3

There are several ways to achieve this result: If you want to disable only the minimize and maximize buttons, you can use the MaximizeBox and MinimizeBox :

If they are set to true :

Iftheyaresettofalse:

Or use the property ControlBox , which when false removes all the contents of the header (Except the title of the same):

    
14.04.2015 / 15:27