Accueil quit V1

This commit is contained in:
adri 2018-02-07 14:29:14 +01:00
parent 1e2077c110
commit 115f20211b
8 changed files with 54 additions and 22 deletions

View File

@ -49,10 +49,9 @@ namespace COURS01
private void btnEntrez_Click(object sender, EventArgs e) private void btnEntrez_Click(object sender, EventArgs e)
{ {
EcranPrincipal f = new EcranPrincipal(); EcranPrincipal f = new EcranPrincipal(this);
this.Hide(); this.Hide();
f.ShowDialog();//Bloque la fenetre parrent alors que show ne bloque pas le parent f.ShowDialog();//Bloque la fenetre parrent alors que show ne bloque pas le parent
this.Show();
} }
} }
} }

View File

@ -30,11 +30,11 @@
{ {
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.mFenetre = new System.Windows.Forms.ToolStripMenuItem(); this.mFenetre = new System.Windows.Forms.ToolStripMenuItem();
this.mAide = new System.Windows.Forms.ToolStripMenuItem();
this.mQuitter = new System.Windows.Forms.ToolStripMenuItem();
this.mfProgression = new System.Windows.Forms.ToolStripMenuItem(); this.mfProgression = new System.Windows.Forms.ToolStripMenuItem();
this.mfListe = new System.Windows.Forms.ToolStripMenuItem(); this.mfListe = new System.Windows.Forms.ToolStripMenuItem();
this.mfEditeur = new System.Windows.Forms.ToolStripMenuItem(); this.mfEditeur = new System.Windows.Forms.ToolStripMenuItem();
this.mAide = new System.Windows.Forms.ToolStripMenuItem();
this.mQuitter = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -60,22 +60,6 @@
this.mFenetre.Size = new System.Drawing.Size(58, 20); this.mFenetre.Size = new System.Drawing.Size(58, 20);
this.mFenetre.Text = "Fenêtre"; this.mFenetre.Text = "Fenêtre";
// //
// mAide
//
this.mAide.Name = "mAide";
this.mAide.ShortcutKeys = System.Windows.Forms.Keys.F1;
this.mAide.Size = new System.Drawing.Size(43, 20);
this.mAide.Text = "Aide";
this.mAide.Click += new System.EventHandler(this.mNDef_Click);
//
// mQuitter
//
this.mQuitter.Name = "mQuitter";
this.mQuitter.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
this.mQuitter.Size = new System.Drawing.Size(56, 20);
this.mQuitter.Text = "Quitter";
this.mQuitter.Click += new System.EventHandler(this.mQuitter_Click);
//
// mfProgression // mfProgression
// //
this.mfProgression.Name = "mfProgression"; this.mfProgression.Name = "mfProgression";
@ -97,6 +81,22 @@
this.mfEditeur.Text = "Editeur"; this.mfEditeur.Text = "Editeur";
this.mfEditeur.Click += new System.EventHandler(this.mNDef_Click); this.mfEditeur.Click += new System.EventHandler(this.mNDef_Click);
// //
// mAide
//
this.mAide.Name = "mAide";
this.mAide.ShortcutKeys = System.Windows.Forms.Keys.F1;
this.mAide.Size = new System.Drawing.Size(43, 20);
this.mAide.Text = "Aide";
this.mAide.Click += new System.EventHandler(this.mNDef_Click);
//
// mQuitter
//
this.mQuitter.Name = "mQuitter";
this.mQuitter.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
this.mQuitter.Size = new System.Drawing.Size(56, 20);
this.mQuitter.Text = "Quitter";
this.mQuitter.Click += new System.EventHandler(this.mQuitter_Click);
//
// EcranPrincipal // EcranPrincipal
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -109,6 +109,7 @@
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "EcranPrincipal"; this.Name = "EcranPrincipal";
this.Text = "Ecran Principal"; this.Text = "Ecran Principal";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.mQuitter_Click);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -12,15 +12,47 @@ namespace COURS01
{ {
public partial class EcranPrincipal : Form public partial class EcranPrincipal : Form
{ {
Form parentToClose;
bool parentToCloseF;
public EcranPrincipal() public EcranPrincipal()
{ {
parentToCloseF = false;
InitializeComponent(); InitializeComponent();
} }
public EcranPrincipal(Form parentToClose)
{
parentToCloseF = true;
InitializeComponent();
this.parentToClose = parentToClose;
}
private void mQuitter_Click(object sender, EventArgs e) private void mQuitter_Click(object sender, EventArgs e)
{ {
Close(); if(parentToCloseF)
{
parentToClose.Close();
if (parentToClose.IsDisposed)
Close();
}
else
Close();
} }
private void mQuitter_Click(object sender, FormClosingEventArgs e)
{
if (parentToCloseF)
{
parentToClose.Close();
if (parentToClose.IsDisposed)
{
e.Cancel = false;
}
else
e.Cancel = true;
}
else
e.Cancel = false;
}
private void mNDef_Click(object sender, EventArgs e) private void mNDef_Click(object sender, EventArgs e)
{ {
MessageBox.Show("Fonctionnalité non implémentée"); MessageBox.Show("Fonctionnalité non implémentée");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.