public override void Execute() { FindDialog.CloseIfOpen(); FindInFilesDialog.CloseIfOpen(); ReplaceDialog replaceDialog = ReplaceDialog.GetReplaceDialog(this.FindReplaceModel, this.TextEditor, this.MessageDisplayService); if (!this.TextEditor.IsSelectionEmpty) { string text = this.TextEditor.GetText(this.TextEditor.SelectionStart, this.TextEditor.SelectionLength); if (!string.IsNullOrEmpty(text) && text.IndexOf('\n') == -1) { replaceDialog.FindText = text; } } replaceDialog.Show(); }
void MenuEditReplaceOnClick(object obj, EventArgs ea) { if (OwnedForms.Length > 0) { return; } txtbox.HideSelection = false; ReplaceDialog dlg = new ReplaceDialog(); dlg.Owner = this; dlg.FindText = strFind; dlg.ReplaceText = strReplace; dlg.MatchCase = bMatchCase; dlg.FindDown = bFindDown; dlg.FindNext += new EventHandler(FindDialogOnFindNext); dlg.Replace += new EventHandler(ReplaceDialogOnReplace); dlg.ReplaceAll += new EventHandler(ReplaceDialogOnReplaceAll); dlg.CloseDlg += new EventHandler(FindReplaceDialogOnCloseDlg); dlg.Show(); }
private void replaceToolStripMenuItem_Click(object sender, EventArgs e) { ReplaceDialog replaceDialog = new ReplaceDialog(this); replaceDialog.Show(); }
public void 替换ToolStripMenuItem_Click(object sender, EventArgs e) { //RichTextBox r = new RichTextBox(); r = GetCurrentRichTextBox(); ReplaceDialog f = new ReplaceDialog(); f.rtb = r; //传值(从主窗口传到FindForm) f.Owner = this; //悬浮于当前窗体 f.Show(); }