0

简单来说,如何订阅和处理以下事件?

System.Windows.Forms.Application.Exit(new System.ComponentModel.CancelEventArgs(true));

因为显然这不会给我我的 CancelEventArgs:

Application.ApplicationExit += new EventHandler(ApplicationExitHandler);
private void ApplicationExitHandler(Object sender, EventArgs e)
{
    ...
}
4

1 回答 1

1

Try to put Event inside the Form1.Designer.cs

  private void InitializeComponent()
        {
          //.......... UI iniatilization

           System.Windows.Forms.Application.ApplicationExit +=new System.EventHandler(ApplicationExitHandler);

        }

In Form1.cs

 private void ApplicationExitHandler(Object sender, EventArgs e)
        {
           //.............
        }
于 2013-02-26T05:07:39.060 回答