예제 #1
0
        /// <summary>
        /// Handles copy, paste etc.
        /// </summary>
        /// <param name="canvas">Canvas.</param>
        /// <param name="chr">Input character.</param>
        /// <returns>True if the key was handled.</returns>
        public static bool DoSpecialKeys(Controls.ControlBase canvas, char chr)
        {
            if (null == KeyboardFocus)
            {
                return(false);
            }
            if (KeyboardFocus.GetCanvas() != canvas)
            {
                return(false);
            }
            if (!KeyboardFocus.IsVisible)
            {
                return(false);
            }
            if (!IsControlDown)
            {
                return(false);
            }

            if (chr == 'C' || chr == 'c')
            {
                KeyboardFocus.InputCopy(null);
                return(true);
            }

            if (chr == 'V' || chr == 'v')
            {
                KeyboardFocus.InputPaste(null);
                return(true);
            }

            if (chr == 'X' || chr == 'x')
            {
                KeyboardFocus.InputCut(null);
                return(true);
            }

            if (chr == 'A' || chr == 'a')
            {
                KeyboardFocus.InputSelectAll(null);
                return(true);
            }

            return(false);
        }