private void frmCodeViewNew_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode.Equals(Keys.Escape)) { if (MessageBox.Show("Are you sure you wish to close this file?", "Are you sure?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { //this.Visible = false; this.Close(); } } else if (e.Control && e.KeyCode.ToString().Equals("W")) { if (MessageBox.Show("Are you sure you wish to close this file?", "Are you sure?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { //this.Visible = false; this.Close(); } } else if (e.KeyCode.Equals(Keys.Enter)) // this is a terrible hack as the onKeyPress events didn't fire in the Scintilla events { if (this.Scintilla.Selection.Length > 0) { frmMaster.DoSearchFromCode(Scintilla.Selection.Text.TrimEnd(' ')); e.Handled = true; } } }
private void searchToolStripMenuItem_Click(object sender, EventArgs e) { if (richText.SelectedText.Length > 0) { frmMaster.DoSearchFromCode(richText.SelectedText.TrimEnd(' ')); } }