Esempio n. 1
0
        public bool ProcessMessage(IntPtr hwnd, UInt32 message, UInt32 wParam, UInt32 lParam, UInt32 time, Int32 xPos, Int32 yPos)
        {
            // Handle keyboard shortcuts
            if ((message == 0x0100) || (message == 0x0104) && (Control.ModifierKeys != Keys.None))
            {
                Keys keyPress = (Keys)wParam;

                if (keyPress == Keys.ControlKey)
                {
                    return(false);
                }

                var modifiers = Control.ModifierKeys;

                if ((modifiers & Keys.Control) == Keys.Control)
                {
                    keyPress |= Keys.Control;
                }

                if ((modifiers & Keys.Shift) == Keys.Shift)
                {
                    keyPress |= Keys.Shift;
                }

                if ((modifiers & Keys.Alt) == Keys.Alt)
                {
                    keyPress |= Keys.Alt;
                }

                return(CommandHandling.ProcessMenuShortcut(keyPress, ContextMenu.Items));
            }

            return(false);
        }
        public bool ProcessMessage(IntPtr hwnd, UInt32 message, UInt32 wParam, UInt32 lParam, UInt32 time, Int32 xPos, Int32 yPos)
        {
            const int WM_KEYDOWN    = 0x0100;
            const int WM_SYSKEYDOWN = 0x0104;

            switch (message)
            {
            case WM_KEYDOWN:
            case WM_SYSKEYDOWN:
                if (CurrentWorksheet.IsEditing && (wParam == (UInt32)Keys.Escape))
                {
                    CurrentWorksheet.EndEdit(EndEditReason.Cancel);
                    return(true);
                }
                else if (!CurrentWorksheet.IsEditing && (wParam == (UInt32)Keys.F2))
                {
                    CurrentWorksheet.StartEdit();
                    return(true);
                }
                // else
                return(CommandHandling.ProcessMenuShortcut(wParam, MenuBar.Items));
            }

            return(false);
        }
Esempio n. 3
0
        public bool ProcessMessage(IntPtr hwnd, UInt32 message, UInt32 wParam, UInt32 lParam, UInt32 time, Int32 xPos, Int32 yPos)
        {
            // Handle keyboard shortcuts
            if ((message == 0x0100) || (message == 0x0104) && (Control.ModifierKeys != Keys.None))
            {
                Keys keyPress = (Keys)wParam;

                if (keyPress == Keys.ControlKey)
                {
                    return(false);
                }

                var modifiers = Control.ModifierKeys;

                if ((modifiers & Keys.Control) == Keys.Control)
                {
                    keyPress |= Keys.Control;
                }

                if ((modifiers & Keys.Shift) == Keys.Shift)
                {
                    keyPress |= Keys.Shift;
                }

                if ((modifiers & Keys.Alt) == Keys.Alt)
                {
                    keyPress |= Keys.Alt;
                }

                if (CommandHandling.ProcessMenuShortcut(keyPress, ContextMenu.Items))
                {
                    return(true);
                }

                // Pick up any stragglers
                switch (keyPress)
                {
                case Keys.Tab:
                    SelectedHtml = " ";
                    return(true);

                case Keys.Left | Keys.Control:
                {
                    var range = GetTextRange();

                    if (range != null)
                    {
                        range.move("word", -1);
                        range.collapse();
                        range.select();
                    }
                }
                    return(true);

                case Keys.Right | Keys.Control:
                {
                    var range = GetTextRange();

                    if (range != null)
                    {
                        range.move("word", 1);
                        range.collapse();
                        range.select();
                    }
                }
                    return(true);

                case Keys.Oemcomma | Keys.Control:
                    FormatFontDecrease();
                    return(true);

                case Keys.OemPeriod | Keys.Control:
                    FormatFontIncrease();
                    return(true);
                }
            }

            return(false);
        }