/// <summary> /// Does application-wide cut /// </summary> public static void Cut() { Control activeControl = Application.ActiveControl; if (activeControl == null) { return; } System.Windows.Forms.TextBoxBase active = activeControl as System.Windows.Forms.TextBoxBase; if (active != null) { active.Cut(); return; } System.Windows.Forms.WebBrowser webbrowser = activeControl as System.Windows.Forms.WebBrowser; if (webbrowser != null) { WebBrowserHelper.ExecCopy(webbrowser); ///TODO: don't work in unix return; } MethodInfo method = activeControl.GetType().GetMethod("Cut"); if (method != null) { FunctionWithoutReturn getMethod = (FunctionWithoutReturn)Delegate.CreateDelegate (typeof(FunctionWithoutReturn), activeControl, method); getMethod(); } }
void OnCopy(object sender, EditingManagerEventArgs e) { System.Windows.Forms.WebBrowser webbrowser = FreeCL.Forms.Application.ActiveControl as System.Windows.Forms.WebBrowser; if (webbrowser == wBrowser) { WebBrowserHelper.ExecCopy(wBrowser); e.Handled = true; //replace rtf with simple text try { string text = System.Windows.Forms.Clipboard.GetText(); if (!string.IsNullOrEmpty(text)) { text = text.Trim().Replace("\r\n\r\n", "\r\n"); System.Windows.Forms.Clipboard.SetText(text); } } catch (System.Runtime.InteropServices.ExternalException) { } } }