Win.Forms remove close/hide button from top

In my latest project I have a task for removing close button. And I found one solution for make it. Just check it :) You have to add this lines to your form class.

#region [ Remove close button ]

private const int CP_NOCLOSE_BUTTON = 0x200;
protected override CreateParams CreateParams
{
    get
    {
        CreateParams createdParams = base.CreateParams;
        createdParams.ClassStyle = createdParams.ClassStyle | CP_NOCLOSE_BUTTON;
        return createdParams;
    }
}

#endregion
0 notes