Make close button hide instead of closing

.net, c#, winforms

Solution

You could just capture the `FormClosing` event and stop the default action, then instead of closing the form just hide it:

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
    e.Cancel = true;
    this.Hide();
}

Problem

How can I make the close button on a form effectively act as a 'Hide' button? Is there a way to abort the `FormClosing` event?

Original source

Related problems