To disable that little close button in your Windows form, either you can set the ControlBox field in Properties window to False or or add this two line in the contructor:
this.ControlBox = false;
Same goes for Maximize and Minimize boxes. Set it using Properties window or add these lines:
this.MaximizeBox = false; this.MinimizeBox = false;
Simple, huh?

April 7, 2008 at 7:03 pm
if you disable the control box you automatically lose the icon, minimize and maximize buttons.
August 23, 2008 at 2:06 am
simple but incorrect
check http://www.codeproject.com/KB/cs/DisableClose.aspx
for a working solution
November 29, 2008 at 4:52 pm
Thank you!!! that small works miracles.. the code for making the close inactive.. thank you
private const int
CP_NOCLOSE_BUTTON = 0×200;
protected override CreateParams CreateParams
{
get
{
CreateParams myCp = base.CreateParams;
myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON ;
return myCp;
}
}
January 27, 2009 at 12:58 pm
Many Thanks for your answer
May 19, 2009 at 1:00 pm
Thank you! Excellent snippet!
October 3, 2009 at 2:52 pm
great.. thank you.