Alex Rivera | Logout

Disabling Minimize & Maximize On WinForm?

Asked 2010-06-11T20:15:54.143
122

WinForms have those three boxes in the upper right hand corner that minimize, maximize, and close the form. What I want to be able to do is to remove the minimize and maximize, while keeping the close.

I also what to make the close minimize the form instead of closing it.

How can this be done?

Edit
Report

1 Answer

191

The Form has two properties called MinimizeBox and MaximizeBox, set both of them to false.

To stop the form closing, handle the FormClosing event, and set e.Cancel = true; in there and after that, set WindowState = FormWindowState.Minimized;, to minimize the form.

answered 2010-06-11T20:19:48.053

Your Answer