Prevent users from resizing the window/form size

81,909

Solution 1

Set the FormBorderStyle to another value like FixedSingle or FixedDialog.

Solution 2

Change FormBorderStyle to FixedDialog, FixedSingle, or Fixed3D. Also, if you do not want them to maximize the form set Maximize to False.

Solution 3

There are a few of workarounds for this:

  1. Set maximum size property to a value you prefer. If you do not want the application window to be shrunk as well, then set a minimum size property. If you prefer the application to have the exact same size as that of design time, then set both maximum size and minimum size as size of your window. (Once you set maximum size or minimum size from the designer, you can't resize your window programmatically, unless you re-set maximum size and minimum size programmatically again)

  2. Set FormBorderStyle to FixedSingle or FixedDialog. The difference in looks wont be noticeable for untrained eyes, but one considerable difference I'd found from my experience is that, when you make it FixedSingle, you can still change the size programmatically. With FixedDialog its not possible. That's a huge advantage for FixedSingle property. (If you want to change size of your window programmatically here after going for FixedDialog, then you got to programmatically change FormBorderStyle first, which would create a slight blink effect when running the application).

So simply go for FixedSingle. And to make sense, do the following:

a. Set maximize box property to false.

b. Set SizeGripStyle to Hide.

Solution 4

Change the BorderStyle to be one of the "Fixed" styles and remove the maximize button.

Solution 5

From the Form Properties Window set:
1. FormBorderStyle -> FixedSingle.
2. MaximizeBox -> False.

Share:
81,909
Mary
Author by

Mary

Updated on August 14, 2020

Comments

  • Mary
    Mary almost 4 years

    User can change form size. I do not find a property of form that do not allow user to change form size.

  • Fatima
    Fatima over 11 years
    whay a complete explanation, thanx @nawfal