diff --git a/psychorientation/psychorientation/Config.cs b/psychorientation/psychorientation/Config.cs index 8a504f87b97d2f7d937c3508f20733f4c87f88e0..cb21581e0dc163f6ef9645c35161b0a9eb1f406f 100644 --- a/psychorientation/psychorientation/Config.cs +++ b/psychorientation/psychorientation/Config.cs @@ -24,7 +24,6 @@ namespace psychorientation { Config.instance = JsonConvert.DeserializeObject<Config>(File.ReadAllText("config.json")); - Console.WriteLine(Config.instance.coeffEffortOral); return Config.instance; } else diff --git a/psychorientation/psychorientation/InterfaceClasse.Designer.cs b/psychorientation/psychorientation/InterfaceClasse.Designer.cs index 8baaf12351b0938b314e66dea04213da24cb303e..bd6eeb26cbc36ac3d0ad654e6ddb927d3cce1c12 100644 --- a/psychorientation/psychorientation/InterfaceClasse.Designer.cs +++ b/psychorientation/psychorientation/InterfaceClasse.Designer.cs @@ -236,6 +236,7 @@ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InterfaceClasse_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); this.SizeChanged += new System.EventHandler(this.InterfaceClasse_SizeChanged); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.InterfaceClasse_KeyDown); ((System.ComponentModel.ISupportInitialize)(this.pb_action_suivante)).EndInit(); this.pnlListeEleve.ResumeLayout(false); this.pnlListeEleve.PerformLayout(); diff --git a/psychorientation/psychorientation/InterfaceClasse.cs b/psychorientation/psychorientation/InterfaceClasse.cs index 5272b92d2452dab7f4a2218e9aa646361d2698e3..8c03c2a2c2d6b0d3a04d52835b96a58fdbca47bf 100644 --- a/psychorientation/psychorientation/InterfaceClasse.cs +++ b/psychorientation/psychorientation/InterfaceClasse.cs @@ -41,7 +41,9 @@ namespace psychorientation { AjouterEleveImage(); GenererBase(); - + + TransmitKeyDown(); + /* Message mAccueil = new Message("Bonjour apprenti prof, vous allez apprendre à éduquer des joueurs !! ", "Début", TypeMessage.INFORMATION); mAccueil.ShowDialog(); @@ -67,7 +69,6 @@ namespace psychorientation y += 220; } - TrackBar tbNota = new TrackBar(); tbNota.Location = new System.Drawing.Point(0, lblNotation.Location.Y + lblNotation.Size.Height); tbNota.Size = new System.Drawing.Size(184, 45); @@ -250,10 +251,38 @@ namespace psychorientation { if (MessageBox.Show("Souhaitez-vous quitter le jeu ?\nVous perdrez alors votre progression dans la partie en cours.", - "Confirmation de fermeture", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) + "Confirmation de fermeture", + MessageBoxButtons.YesNo, + MessageBoxIcon.Warning, + MessageBoxDefaultButton.Button2 + ) + == DialogResult.No) { e.Cancel = true; } } + + private void TransmitKeyDown() + { + foreach (Control c in this.Controls) + { + if (c is Panel) + { + foreach (Control c2 in (c as Panel).Controls) + { + c2.KeyDown += new System.Windows.Forms.KeyEventHandler(InterfaceClasse_KeyDown); + } + } + c.KeyDown += new System.Windows.Forms.KeyEventHandler(InterfaceClasse_KeyDown); + } + } + + private void InterfaceClasse_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Escape) + { + Close(); + } + } } } diff --git a/psychorientation/psychorientation/InterfaceClasse.resx b/psychorientation/psychorientation/InterfaceClasse.resx index d001120128a3931635a5e58beb981d55a4f44342..086595386851d7cfe1994cc8b2b96472ddac6b2e 100644 --- a/psychorientation/psychorientation/InterfaceClasse.resx +++ b/psychorientation/psychorientation/InterfaceClasse.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM - mgEAAk1TRnQBSQFMAgEBBgEAAWABAAFgAQAByAEAAcgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + mgEAAk1TRnQBSQFMAgEBBgEAAXABAAFwAQAByAEAAcgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABIAEDAgABkAEBAgABAQEAAQgGAAHiAQQXAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEA AcAB3AHAAQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEA A0IBAAM5AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIA diff --git a/psychorientation/psychorientation/InterfaceInfoCompletEleve.Designer.cs b/psychorientation/psychorientation/InterfaceInfoCompletEleve.Designer.cs index 7dbead6763a08d54ad195f62a7f861c02a33fee0..80b987cbd10ae4bf6df8d70492617551e508b84a 100755 --- a/psychorientation/psychorientation/InterfaceInfoCompletEleve.Designer.cs +++ b/psychorientation/psychorientation/InterfaceInfoCompletEleve.Designer.cs @@ -189,6 +189,7 @@ this.Text = "InterfaceInfoCompletEleve"; this.TopMost = true; this.Load += new System.EventHandler(this.InterfaceInfoCompletEleve_Load); + this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.InterfaceInfoCompletEleve_KeyPress); this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pcbEleve)).EndInit(); diff --git a/psychorientation/psychorientation/InterfaceInfoCompletEleve.cs b/psychorientation/psychorientation/InterfaceInfoCompletEleve.cs index de2f7e31019dfc7dd21cd32c7aa39ca7f95b4892..229eaffa90911737a74c899d7969e86b7bbf3caa 100755 --- a/psychorientation/psychorientation/InterfaceInfoCompletEleve.cs +++ b/psychorientation/psychorientation/InterfaceInfoCompletEleve.cs @@ -108,5 +108,13 @@ namespace psychorientation lbl.Text = contenu; return lbl; } + + private void InterfaceInfoCompletEleve_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == 27) // Echap + { + Close(); + } + } } } diff --git a/psychorientation/psychorientation/Menu.Designer.cs b/psychorientation/psychorientation/Menu.Designer.cs index 93f62629a1b01e4f88528182844c0e0263ddb515..1e82090610c28e6eace40b33c4e79a7081d0e5b5 100644 --- a/psychorientation/psychorientation/Menu.Designer.cs +++ b/psychorientation/psychorientation/Menu.Designer.cs @@ -82,6 +82,7 @@ this.Name = "Menu"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Menu"; + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Menu_KeyDown); this.ResumeLayout(false); this.PerformLayout(); diff --git a/psychorientation/psychorientation/Menu.cs b/psychorientation/psychorientation/Menu.cs index 232faadb3c8365a679a8323ff311c4382b615433..00e62793d30f5daf18589699269c60e8fb0a68cf 100644 --- a/psychorientation/psychorientation/Menu.cs +++ b/psychorientation/psychorientation/Menu.cs @@ -15,6 +15,8 @@ namespace psychorientation public Menu() { InitializeComponent(); + + TransmitKeyDown(); } private void button1_Click(object sender, EventArgs e) @@ -29,5 +31,28 @@ namespace psychorientation InterfaceClasse iC = new InterfaceClasse(true); iC.Show(); } + + private void TransmitKeyDown() + { + foreach (Control c in this.Controls) + { + if (c is Panel) + { + foreach (Control c2 in (c as Panel).Controls) + { + c2.KeyDown += new System.Windows.Forms.KeyEventHandler(Menu_KeyDown); + } + } + c.KeyDown += new System.Windows.Forms.KeyEventHandler(Menu_KeyDown); + } + } + + private void Menu_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Escape) + { + Close(); + } + } } }