private void codeBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == (Keys.Space | Keys.Control)) { //forced show (MinFragmentLength will be ignored) popupMenu.Show(true); e.Handled = true; } if (e.KeyCode == Keys.Escape) { popupMenu.Close(); } if (e.KeyData == (Keys.K | Keys.Control)) { codeTextBox.InsertLinePrefix("//"); } if (e.KeyData == (Keys.K | Keys.Control | Keys.Shift)) { codeTextBox.RemoveLinePrefix("//"); } if (e.KeyData == (Keys.Control | Keys.P)) { codeTextBox.CollapseAllFoldingBlocks(); codeTextBox.ExpandAllFoldingBlocks(); } }