Esempio n. 1
0
        /// <summary>
        /// Does application-wide cut
        /// </summary>
        public static void Paste()
        {
            Control activeControl = Application.ActiveControl;

            if (activeControl == null)
            {
                return;
            }

            System.Windows.Forms.TextBoxBase active = activeControl as System.Windows.Forms.TextBoxBase;
            if (active != null)
            {
                active.Paste();
                return;
            }

            MethodInfo method = activeControl.GetType().GetMethod("Paste");

            if (method != null)
            {
                FunctionWithoutReturn getMethod = (FunctionWithoutReturn)Delegate.CreateDelegate
                                                      (typeof(FunctionWithoutReturn), activeControl, method);

                getMethod();
            }
        }
Esempio n. 2
0
        /// <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();
            }
        }