protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); if (!Properties.Settings.Default.HideExitDialog) { ClosingDialogueForm cdf = new ClosingDialogueForm(); if (cdf.ShowDialog() == System.Windows.Forms.DialogResult.No) { e.Cancel = true; } } }