简体   繁体   English

我无法通过调整大小来减小表单的大小

[英]I can't reduce the size of the form with resize

I am creating a form in windows forms and I need the user to be able to resize it according to the size of the monitor.我正在 windows forms 中创建一个表单,我需要用户能够根据显示器的大小调整它的大小。 So far so good.到目前为止,一切都很好。 I set FormBorderStyle = Sizable, and with that I was able to increase the size of the form, but I cannot decrease the size.我设置了 FormBorderStyle = Sizable,这样我就可以增加表单的大小,但不能减小大小。 I need to decrease the size.我需要减小尺寸。 Can someone help me?有人能帮我吗?

Have you ensured the form's MinimumSize is correctly set?您是否确保正确设置了表单的MinimumSize

You can use SystemInformation.WorkingArea :您可以使用SystemInformation.WorkingArea

Location = SystemInformation.WorkingArea.Location;
Size = SystemInformation.WorkingArea.Size;

Or the Screen :屏幕

  Location = Screen.PrimaryScreen.WorkingArea.Location;
  Size = Screen.PrimaryScreen.WorkingArea.Size;

Also you can get information from required monitor .您还可以从所需的监视器获取信息。

The working area if the desktop available space without any task and tool bars.工作区如果桌面可用空间没有任何任务和工具栏。

Keep in mind that the ability to change the size of the form if conditioned by the MinimumSize and MaximumSize properties of the form, and any value outside the limits is set to the corresponding limit.请记住,如果以窗体的MinimumSizeMaximumSize属性为条件,并且任何超出限制的值都设置为相应的限制,则更改窗体大小的能力。

There is also the WindowsState property having the WindowsState.Maximize enum value.还有一个具有WindowsState.Maximize枚举值的WindowsState属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM