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

发布于 2024-10-25 22:37:33 字数 66 浏览 1 评论 0原文

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

我尝试了 AutoSize 和 AutoSizeMode。

How do I disable form resizing for users? Which property is used?

I tried AutoSize and AutoSizeMode.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

很酷又爱笑 2024-11-01 22:37:37

使用 FormBorderStyle 属性。使其成为FixedSingle

this.FormBorderStyle = FormBorderStyle.FixedSingle;

Use the FormBorderStyle property. Make it FixedSingle:

this.FormBorderStyle = FormBorderStyle.FixedSingle;
弱骨蛰伏 2024-11-01 22:37:37

使用 FormFormBorderStyle 属性:

this.FormBorderStyle = FormBorderStyle.FixedDialog;

Use the FormBorderStyle property of your Form:

this.FormBorderStyle = FormBorderStyle.FixedDialog;
做个少女永远怀春 2024-11-01 22:37:37

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

FormBorderStyle = FormBorderStyle.FixedDialog;

更改前的设计器视图:

在此处输入图像描述

Change this property and try this at design time:

FormBorderStyle = FormBorderStyle.FixedDialog;

Designer view before the change:

Enter image description here

夏末染殇 2024-11-01 22:37:37

我总是使用这个:

// Lock form
this.MaximumSize = this.Size;
this.MinimumSize = this.Size;

这样您就可以随时从设计器调整表单的大小,而无需更改代码。

I always use this:

// Lock form
this.MaximumSize = this.Size;
this.MinimumSize = this.Size;

This way you can always resize the form from Designer without changing code.

梦中的蝴蝶 2024-11-01 22:37:37

使用表单的 MaximumSizeMinimumSize 属性将固定表单大小,并阻止用户调整表单大小,同时保持表单默认 FormBorderStyle

this.MaximumSize = new Size(XX, YY);
this.MinimumSize = new Size(X, Y);

Using the MaximumSize and MinimumSize properties of the form will fix the form size, and prevent the user from resizing the form, while keeping the form default FormBorderStyle.

this.MaximumSize = new Size(XX, YY);
this.MinimumSize = new Size(X, Y);
情感失落者 2024-11-01 22:37:37

我会设置最大尺寸、最小尺寸并删除窗口的抓手图标。

设置属性(MaximumSize、MinimumSize 和 SizeGripStyle):

this.MaximumSize = new System.Drawing.Size(500, 550);
this.MinimumSize = new System.Drawing.Size(500, 550);
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;

I would set the maximum size, minimum size and remove the gripper icon of the window.

Set properties (MaximumSize, MinimumSize, and SizeGripStyle):

this.MaximumSize = new System.Drawing.Size(500, 550);
this.MinimumSize = new System.Drawing.Size(500, 550);
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
嗼ふ静 2024-11-01 22:37:36

FormBorderStyle 更改为固定值之一:FixedSingleFixed3D
FixedDialogFixedToolWindow

FormBorderStyle 属性位于Appearance 类别下。

或者检查这个:

// 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();

Change the FormBorderStyle to one of the fixed values: FixedSingle, Fixed3D,
FixedDialog or FixedToolWindow.

The FormBorderStyle property is under the Appearance category.

Or check this:

// 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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文