14

I want that the user shouldn't be able to resize the window form. I was able to disable the maximize button but wasn't able to find any property to disable resizing.

Any help?

Manish
  • 6,106
  • 19
  • 64
  • 90
  • 3
    Bad coder, bad! No gnawing on usability! – ANeves Apr 05 '10 at 15:01
  • 2
    possible duplicate of [How can I prevent users from changing the window/form size when application is running](http://stackoverflow.com/questions/1330339/how-can-i-prevent-users-from-changing-the-window-form-size-when-application-is-r) – bluish Aug 25 '15 at 12:45

5 Answers5

28

You need to set the FormBorderStyle property to one of the fixed values.

Austin Salonen
  • 49,173
  • 15
  • 109
  • 139
11

Change the FormBorderStyle to FixedSingle. Also set MinimizeBox and MaximizeBox to False. Even double clicking the title will not maximize the form.

Cheddar
  • 4,680
  • 1
  • 19
  • 10
2

Assuming you are talking about a WinForms form, you can disable resizing by changing the FormBorderStyle property to one of the Fixed values, such as FixedSingle. There are also MaximumSize and MinimumSize properties that may be set if you want to allow some, but not total, resizing.

If you are talking about a WPF application, then you can set the ResizeMode property to NoResize, or you can set the MaxHeight, MaxWidth, MinHeight, and MinWidth properties.

As noted in the comments for the question, make sure you have a good reason to disable resizing. Most of the time, there are better alternatives that allow resizing (especially in WPF).

Jeffrey L Whitledge
  • 58,241
  • 9
  • 71
  • 99
1

Set MaximumSize and MinimumSize to the current form size

  this.MaximumSize = new System.Drawing.Size(x, y);
  this.MinimumSize = new System.Drawing.Size(x, y);
Prasanth V J
  • 1,126
  • 14
  • 32
0

Change the frame/border type to a non-resizeable type.

Anders Abel
  • 67,989
  • 17
  • 150
  • 217