using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace COURS01 { public partial class EcranPrincipal : Form { Form parentToClose; bool parentToCloseF; public EcranPrincipal() { parentToCloseF = false; InitializeComponent(); } public EcranPrincipal(Form parentToClose) { parentToCloseF = true; InitializeComponent(); this.parentToClose = parentToClose; } private void mQuitter_Click(object sender, EventArgs e) { Close(); } private void mQuitter_Click(object sender, FormClosingEventArgs e) { Close(); } private void mNDef_Click(object sender, EventArgs e) { MessageBox.Show("Fonctionnalité non implémentée"); } private void EcranAccueil_FormClosing(object sender, FormClosingEventArgs e) { if (MessageBox.Show("Voulez-vous vraiment quiter ?", "Souhait", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { e.Cancel = false; } else { e.Cancel = true; } } } }