title: Detect reason for form closing
body: <p>How can I detect how a windows form is being closed?  For example, how do I find out whether the user has clicked on a button which closes the form or if the user clicks on the "X" in the upper-right?  Thank you.</p>
  
  <p>Update:</p>
  
  <p>Forgot to mention that the button calls the Application.Exit() method.</p>