13 Mayıs 2012 Pazar

How to disable the Win Form’s Close Button ?

To contact us Click HERE

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.

Hiç yorum yok:

Yorum Gönder