private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals(Keys.Space)) { this.Hide(); restoreToolStripMenuItem.Enabled = true; } else if (e.KeyChar.Equals(Keys.M)) { //If the menu is hidden, show it. Otherwise, hide it. if (menuTrayPanel.Tag.Equals("hidden")) { animationTimer.Tick += new EventHandler(displayMenu); animationTimer.Tick -= new EventHandler(hideMenu); //Don't trigger the hideMenu void when displaying it displayMenu(sender, e); } else { animationTimer.Tick -= new EventHandler(displayMenu); animationTimer.Tick += new EventHandler(hideMenu); //Same as with displaying, but the other way hideMenu(sender, e); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)