private void OnApplicationExit(object sender, EventArgs e) { Application.ApplicationExit -= OnApplicationExit; Dispose(); }