I'm writing a WinForms app with a borderless form. In a regular form, you can double-click on the title bar to toggle its WindowState between Maximized and Normal. How can I do this with a borderless form?
Here's my code for the menu's MouseDoubleClick event handler...
private void MnuMain_MouseDoubleClick(object sender, MouseEventArgs e)
{
// The main menu (MnuMain) is where the form's title would be if the form wasn't borderless.
if (this.WindowState == FormWindowState.Normal)
{
this.WindowState = FormWindowState.Maximized;
}
else if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
}
Just replace the event "MouseDoubleClick" with the event "DoubleClick".