private void FormMain_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { menuSimulateNew_Click(null, null); } // Display search form if (e.Control && e.KeyCode == Keys.F) { FormSearch.Show(this, editor1); } if (e.KeyCode == Keys.F3) { FormSearch.FindNext(this, editor1); } }
/// <summary> /// Call this function to show the search form /// </summary> public static void Show(Form owner, Editor editor) { // Create the form if (mFormSearch == null || mFormSearch.IsDisposed) { mFormSearch = new FormSearch(); } // Display the form (possibly with a new owner) mFormSearch.mEditor = editor; if (owner != mFormSearch.Owner) { mFormSearch.Visible = false; } if (!mFormSearch.Visible) { mFormSearch.Show(owner); } // Take selected text for search box (if any) TokenLoc selStart = editor.SelStart; TokenLoc selEnd = editor.SelEnd; if (selStart != selEnd && selStart.Line == selEnd.Line) { string [] search = editor.Lexer.GetText(selStart, selEnd); if (search.Length == 1) { mFormSearch.textSearch.Text = search[0]; } } // Set search box focus mFormSearch.textSearch.Focus(); mFormSearch.textSearch.SelectAll(); }
private void menuEditFindNext_Click(object sender, EventArgs e) { FormSearch.FindNext(this, editor1); }