如何禁用用户的表单大小调整?

Dia*_*ana 115 c# forms resize winforms

如何禁用用户的表单大小调整?使用哪个属性?

我试着AutoSizeAutoSizeMode.

Pra*_*ana 250

更改FormBorderStyle为固定值之一:FixedSingle,Fixed3D, FixedDialogFixedToolWindow.

FormBorderStyle物业属于外观类别.

或检查一下

// Define the border style of the form to a dialog box.
form1.FormBorderStyle = FormBorderStyle.FixedDialog;

// Set the MaximizeBox to false to remove the maximize box.
form1.MaximizeBox = false;

// Set the MinimizeBox to false to remove the minimize box.
form1.MinimizeBox = false;

// Set the start position of the form to the center of the screen.
form1.StartPosition = FormStartPosition.CenterScreen;

// Display the form as a modal dialog box.
form1.ShowDialog();
Run Code Online (Sandbox Code Playgroud)


San*_*ile 43

使用FormBorderStyle属性,制作它FixedSingle

this.FormBorderStyle = FormBorderStyle.FixedSingle;
Run Code Online (Sandbox Code Playgroud)


Jav*_*ram 15

使用FormBorderStyle你的财产Form

this.FormBorderStyle = FormBorderStyle.FixedDialog;
Run Code Online (Sandbox Code Playgroud)


Ami*_*ani 8

更改此属性并在设计时尝试此操作:

FormBorderStyle = FormBorderStyle.FixedDialog;
Run Code Online (Sandbox Code Playgroud)

更改前的设计器视图:

在此处输入图片说明


Ale*_*lig 7

使用MaximumSizeMinimumSize形式的特性,将修复窗体大小,并防止用户调整的形式,同时保持默认的形式FormBorderStyle.

this.MaximumSize = new Size(XX, YY);
this.MinimumSize = new Size(X, Y);
Run Code Online (Sandbox Code Playgroud)


小智 5

我总是用这个:

// Lock form
this.MaximumSize = this.Size;
this.MinimumSize = this.Size;
Run Code Online (Sandbox Code Playgroud)

这样,您始终可以从Designer中调整表单的大小,而无需更改代码。