简体   繁体   中英

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. 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. I need to decrease the size. Can someone help me?

Have you ensured the form's MinimumSize is correctly set?

You can use 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.

There is also the WindowsState property having the WindowsState.Maximize enum value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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