简体   繁体   中英

How to Disable restore box of windows form when it is in maximized condition?

How can I disable the restore button in the control box of a windows form in c#. i need to make the form in maximized condition when it loads. is it possible? even the maximize box property is false, the restore box is shown automatically on the screen.

So from my comment you do 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;

This is from MSDN

To maximize your form you simply do this:

form1.WindowState = FormWindowState.Maximized;

Again this can be found on MSDN

Have a look at this question: How do I remove minimize and maximize from a resizable window in WPF?

The first and most upvoted answer doesn't belong to WPF only. So it should also work with a Winforms application.

在属性面板中设置ResizeMode = CanMinimizewindowState = Maximized

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