Friday, 13 September 2013

How can I hide the close button of a form?

How can I hide the close button of a form?

I am using the code below for showing form icon but disable close button
icon. This works, but I want to hide the button entirely. How can I
achieve that?
public partial class Form1 : Form
{
private const int CS_NOCLOSE = 0x200;
protected override CreateParams CreateParams
{
get
{
CreateParams mdiCp = base.CreateParams;
mdiCp.ClassStyle = mdiCp.ClassStyle | CS_NOCLOSE;
return mdiCp;
}
}
public Form1()
{
InitializeComponent();
}
}

No comments:

Post a Comment