protected override void OnFormClosing(FormClosingEventArgs e) { if (CloseCancel.ConfirmCloseCancel() == true) { e.Cancel = false; } else { e.Cancel = true; } }
protected override void OnFormClosing(FormClosingEventArgs e) { if (CloseCancel.ConfirmCloseCancel() == true) { e.Cancel = false; //Remove the tray icon from view and dispose of it trayIcon.Icon.Dispose(); //Dispose of the tray icon object trayIcon.Dispose(); } else { e.Cancel = true; } }