Exemple #1
0
        private void OnKeyDown(KeyboardMessage msg)
        {
            if (mIsFocused == false)
            {
                return;
            }

            if (msg.Character == '\b')
            {
                EraseCharacter();
                return;
            }

            switch (msg.KeyCode)
            {
            case System.Windows.Forms.Keys.Left:
                MoveCaretLeft();
                return;

            case System.Windows.Forms.Keys.Right:
                MoveCaretRight();
                return;

            case System.Windows.Forms.Keys.Home:
                MoveCaretToStart();
                return;

            case System.Windows.Forms.Keys.End:
                MoveCaretToEnd();
                return;
            }

            if ((char.IsWhiteSpace(msg.Character) && msg.Character != ' ') || char.IsControl(msg.Character))
            {
                return;
            }

            AppendCharacter(msg.Character);
        }
Exemple #2
0
        private void OnKeyDown(KeyboardMessage msg)
        {
            if (mIsFocused == false)
                return;

            if(msg.Character == '\b')
            {
                EraseCharacter();
                return;
            }

            switch (msg.KeyCode)
            {
                case System.Windows.Forms.Keys.Left:
                    MoveCaretLeft();
                    return;
                case System.Windows.Forms.Keys.Right:
                    MoveCaretRight();
                    return;

                case System.Windows.Forms.Keys.Home:
                    MoveCaretToStart();
                    return;

                case System.Windows.Forms.Keys.End:
                    MoveCaretToEnd();
                    return;
            }

            if ((char.IsWhiteSpace(msg.Character) && msg.Character != ' ') || char.IsControl(msg.Character))
                return;

            AppendCharacter(msg.Character);
        }