[英]How can I fix the form size in a C# Windows Forms application and not to let user change its size?
如何在 C# Windows 窗體應用程序中修復窗體大小而不讓用戶更改其大小?
檢查一下:
// 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);
用於防止調整大小事件的最小設置
form1.FormBorderStyle = FormBorderStyle.FixedDialog;
form1.MaximizeBox = false;
屬性 - > FormBorderStyle - > FixedSingle
如果找不到屬性工具。 轉到視圖 - >屬性窗口
我很確定這不是最好的方法,但您可以將MinimumSize
和MaximimSize
屬性設置為相同的值。 這將阻止它。
將Maximize屬性設置為False 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.