Beispiel #1
0
        /// <summary>
        /// Handle key down event for selection and copy.
        /// </summary>
        /// <param name="parent">the control hosting the html to invalidate</param>
        /// <param name="e">the pressed key</param>
        public void HandleKeyDown(RControl parent, RKeyEvent e)
        {
            ArgChecker.AssertArgNotNull(parent, "parent");
            ArgChecker.AssertArgNotNull(e, "e");

            try
            {
                if (e.Control && _selectionHandler != null)
                {
                    // select all
                    if (e.AKeyCode)
                    {
                        _selectionHandler.SelectAll(parent);
                    }

                    // copy currently selected text
                    if (e.CKeyCode)
                    {
                        _selectionHandler.CopySelectedHtml();
                    }
                }
            }
            catch (Exception ex)
            {
                ReportError(HtmlRenderErrorType.KeyboardMouse, "Failed key down handle", ex);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Copy selected text.
 /// </summary>
 private void OnCopyClick(object sender, EventArgs eventArgs)
 {
     try
     {
         _selectionHandler.CopySelectedHtml();
     }
     catch (Exception ex)
     {
         _htmlContainer.ReportError(HtmlRenderErrorType.ContextMenu, "Failed to copy text to clipboard", ex);
     }
     finally
     {
         DisposeContextMenu();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Handle key down event for selection and copy.
        /// </summary>
        /// <param name="parent">the control hosting the html to invalidate</param>
        /// <param name="e">the pressed key</param>
        public void HandleKeyDown(Control parent, KeyEventArgs e)
        {
            ArgChecker.AssertArgNotNull(parent, "parent");
            ArgChecker.AssertArgNotNull(e, "e");

            if (e.Control && _selectionHandler != null)
            {
                // select all
                if (e.KeyCode == Keys.A)
                {
                    _selectionHandler.SelectAll(parent);
                }

                // copy currently selected text
                if (e.KeyCode == Keys.C)
                {
                    _selectionHandler.CopySelectedHtml();
                }
            }
        }