Tuesday 15 July 2014

How to hide Close (x) button for Windows Forms?


Method 1
 
this.ControlBox=false;


Method 2

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

No comments:

Post a Comment