If you write some code like so:
this.ControlBox = false;
this.MaximizeBox = false;
this.MinimizeBox = false;
Where "this" is some form, you may find yourself with a control lacking a blue strip to move the form around! The solution to this problem is to enter some text in the text field.
this.Text = "My useful form";
this.ControlBox = false;
this.MaximizeBox = false;
this.MinimizeBox = false;
And that seems to be how it's done. Of course there are other ways override the message handler or using PInvoke (yes I tried Google before working this out for myself) but you really don't need to.
2 comments:
You can always add a delegate to listen for the FormClosing event.
When you receive it -that is, the user tried to close the form-, you could then cancel it, like in:
private void FormClosingEvent(object sender, FormClosingEventArgs e)
{
e.Cancel = !buttonExit.Enabled;
}
In this case, it only allows closing if a specific exit button is enabled; obviously you can set here your own conditions
best way :)
For closing I use oposite: this.ControlBox = true;
Post a Comment