If you want to prevent the user from closing your form until he has dealt with something really important, you can set
but this also removes the Min, Max, and system menu from the form as well.
You cannot (it seems) remove just the Close box, but you can disable it, and it alone. To disable and grey out the Close box, override the
protected override CreateParams CreateParams
CreateParams parms = base.CreateParams;
parms.ClassStyle |= 0x200; return parms;
- If you do this, all normal methods of closing the form become unavailable to the user. Use this only when it is really needed.
- Remember to provide some way to close the form (and test it!)
2016-07-20 Typo fixed - thanks Brisingr Aerowing!
2010-01-26 Original version