title: How to make Close button work as Minimize: C# Winforms
body: <p>How can I make the (default) <strong>Close</strong> button (at top right corner) in my application, to work it as <strong>Minimize</strong>.
  Actually I want to minimize the application on clicking the cross-symbol, but exit the application, when use clicks on my menu option <strong>Exit</strong>.</p>
  
  <p>I wrote this code for minimizing the form on clicking close button:</p>
  
  <pre><code>private void Form1_FormClosing(object sender, FormClosingEventArgs e)
      {
          if (minimize_on_close == "Yes")
          {
              e.Cancel = true;
              this.WindowState = FormWindowState.Minimized;
          }
      }
  </code></pre>
  
  <p>and wrote this code for exiting the application, on clicking exit from menu options.</p>
  
  <pre><code>private void exitToolStripMenuItem1_Click(object sender, EventArgs e)
      {
          Application.Exit();
      }
  </code></pre>
  
  <p>But now, when I click on <strong>Exit</strong> menu option, then also the form is being minimized, and not exiting.</p>
  
  <p>Can anyone please help?</p>