Disable the Win Form’s Close Button using C#
Here is the simple way to disable the Form’s close button. Just copy the following code in your code behind. Then run the form, surely the close button would be disabled.private const int CP_NOCLOSE_BUTTON = 0x200;
protected override CreateParams CreateParams
{
get
{
CreateParams myCp = base.CreateParams;
myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
return myCp;
}
}
That's it...
S.VinothkumaR.
1 comment:
Your blog has been very useful with my development.
Thanx a lot!
http://shencu.blogspot.com
Post a Comment