private void MainWindow_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Up: this.OnArrowKeyUp(e); break; case Keys.Down: this.OnArrowKeyDown(e); break; case Keys.Enter: // copy selected item to the Windows clipboard LocalClipboard.Copy(); break; case Keys.C: // copy selected item to clipboard on ctrl + c if (e.Control) { LocalClipboard.Copy(); } break; case Keys.Delete: // programmatically click the Remove button this.removeBtn.PerformClick(); break; case Keys.Escape: // minimize to the taskbar this.WindowState = FormWindowState.Minimized; break; case Keys.F4: // minimize to system tray on Alt + F4 if (e.Alt) { this.Visible = false; } break; } // stop event handling chain e.Handled = true; }
private void ListBox_DoubleClick(object sender, EventArgs e) { // copy selected item to the Windows clipboard LocalClipboard.Copy(); }