public static bool Redo() { bool res = Execute(OnRedo); if (!res) { Control activeControl = Application.ActiveControl; if (activeControl == null) { return(false); } System.Windows.Forms.RichTextBox active = activeControl as System.Windows.Forms.RichTextBox; res = active != null; if (res) { active.Redo(); } else { MethodInfo method = activeControl.GetType().GetMethod("Redo"); if (method != null) { Clipboard.FunctionWithoutReturn getMethod = (Clipboard.FunctionWithoutReturn)Delegate.CreateDelegate (typeof(Clipboard.FunctionWithoutReturn), activeControl, method); getMethod(); res = true; } } } return(res); }
public static bool Delete() { bool res = Execute(OnDelete); if (!res) { Control activeControl = Application.ActiveControl; if (activeControl == null) { return(false); } System.Windows.Forms.TextBoxBase active = activeControl as System.Windows.Forms.TextBoxBase; res = active != null; if (res) { if (active.SelectionLength != 0) { active.SelectedText = ""; } else if (active.Text[active.SelectionStart] != '\r') { active.SelectionLength = 1; active.SelectedText = ""; } else { active.SelectionLength = 2; active.SelectedText = ""; } } else { MethodInfo method = activeControl.GetType().GetMethod("Delete"); if (method != null) { Clipboard.FunctionWithoutReturn getMethod = (Clipboard.FunctionWithoutReturn)Delegate.CreateDelegate (typeof(Clipboard.FunctionWithoutReturn), activeControl, method); getMethod(); res = true; } } } return(res); }
public static bool SelectAll() { bool res = Execute(OnSelectAll); if (!res) { Control activeControl = Application.ActiveControl; if (activeControl == null) { return(false); } System.Windows.Forms.TextBoxBase active = activeControl as System.Windows.Forms.TextBoxBase; res = active != null; if (res) { active.SelectAll(); } if (!res) { System.Windows.Forms.WebBrowser webbrowser = activeControl as System.Windows.Forms.WebBrowser; if (webbrowser != null) { WebBrowserHelper.ExecSelectAll(webbrowser); ///TODO: don't work in unix res = true; } } if (!res) { MethodInfo method = activeControl.GetType().GetMethod("SelectAll"); if (method != null) { Clipboard.FunctionWithoutReturn getMethod = (Clipboard.FunctionWithoutReturn)Delegate.CreateDelegate (typeof(Clipboard.FunctionWithoutReturn), activeControl, method); getMethod(); res = true; } } } return(res); }