//当程序关闭时执行 private void Application_Exit(object sender, ExitEventArgs e) { StartupAndExit.ApplicationExit(); }