如何在C#Windows窗体应用程序中固定窗体大小,而不让用户更改其大小?
如何在C#Windows窗体应用程序中固定窗体大小而不让用户更改其大小?我很确定这不是最好的方法,但您可以将如何在C#Windows窗体应用程序中固定窗体大小,而不让用户更改其大小?,c#,.net,winforms,size,fixed,C#,.net,Winforms,Size,Fixed,如何在C#Windows窗体应用程序中固定窗体大小而不让用户更改其大小?我很确定这不是最好的方法,但您可以将MinimumSize和maximmsize属性设置为相同的值。这将停止它。检查以下内容: // Define the border style of the form to a dialog box. form1.FormBorderStyle = FormBorderStyle.FixedDialog; // Set the MaximizeBox to false to remov
MinimumSize
和maximmsize
属性设置为相同的值。这将停止它。检查以下内容:
// 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();
试着设置
this.MinimumSize = new Size(140, 480);
this.MaximumSize = new Size(140, 480);
属性->FormBorderStyle->FixedSingle
如果找不到属性工具。转到查看->属性窗口最小设置以防止调整事件大小
form1.FormBorderStyle = FormBorderStyle.FixedDialog;
form1.MaximizeBox = false;
将Maximize属性设置为False。哦,我是通过更改表单的FormBorderStyle属性得到的……如果对您有效,请不要忘记将答案标记为已接受……@odiseh我偶然发现了这一点,我发现您仍然没有接受答案。请将答案伪装成已被接受的答案-我相信答案中提供了一个有效的解决方案。这对我有很大的帮助。谢谢。我不认为这会阻止你双击标题栏,然后它就满了screens@Tizz我通过designer更改了以上内容,它成功了。双击并没有最大化它。我正在使用VS-2010“最大化属性”?你的意思是“MaximizeBox的
属性”吗?