Quantcast
Viewing all articles
Browse latest Browse all 12583

Enable and disable close button (X) using C#

I want to disable only close(X) button on a windows form and again i want to enable it depending  on a condtion in c#.
I know that i can disable by overriding the CreateParams as below :

 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;
            }
        }

But how to re - enable it again? .I can disable on load but i got struck how to enable it back?Pls help


Viewing all articles
Browse latest Browse all 12583

Trending Articles