简单地说,我如何订阅和处理以下事件?
System.Windows.Forms.Application.Exit(new System.ComponentModel.CancelEventArgs(true));
因为显然这不会给我我的CancelEventArgs:
Application.ApplicationExit += new EventHandler(ApplicationExitHandler);
private void ApplicationExitHandler(Object sender, EventArgs e)
{
...
}
答案 0 :(得分:1)
尝试将事件放在 Form1.Designer.cs
中 private void InitializeComponent()
{
//.......... UI iniatilization
System.Windows.Forms.Application.ApplicationExit +=new System.EventHandler(ApplicationExitHandler);
}
在 Form1.cs
中 private void ApplicationExitHandler(Object sender, EventArgs e)
{
//.............
}