"x" To Minimize WinForm, ContextMenu To Close WinForm?
Posted
by Soo
on Stack Overflow
See other posts from Stack Overflow
or by Soo
Published on 2010-06-15T21:07:29Z
Indexed on
2010/06/15
21:12 UTC
Read the original article
Hit count: 496
Hi SO,
I have a WinForm that I want to minimize when the "x" in the top right corner is clicked. To accomplish this, I have:
private void Form_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
WindowState = FormWindowState.Minimized;
}
That's all well and good, but now I have a context menu that has the option to close the WinForm, but because of the code above, it simply minimizes the window.
How can I get everything to work the way I want it to?
© Stack Overflow or respective owner