Пример #1
0
        public virtual void OnKeyUp(KeyEventArgs e)
        {
            RadCalculatorDropDownElement editorElement = this.EditorElement as RadCalculatorDropDownElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            int length = editorElement.EditorContentElement.Text.Length;

            switch (e.KeyCode)
            {
            case Keys.Left:
                if (this.selectionLength != 0 || (this.RightToLeft || this.selectionStart != 0) && (!this.RightToLeft || this.selectionStart != length))
                {
                    break;
                }
                base.OnKeyDown(e);
                break;

            case Keys.Right:
                if (this.selectionLength != 0 || (this.RightToLeft || this.selectionStart != length) && (!this.RightToLeft || this.selectionStart != 0))
                {
                    break;
                }
                base.OnKeyDown(e);
                break;
            }
        }
Пример #2
0
        public override void OnKeyDown(KeyEventArgs e)
        {
            RadCalculatorDropDownElement editorElement = this.EditorElement as RadCalculatorDropDownElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            this.selectionStart  = editorElement.EditorContentElement.TextBoxItem.SelectionStart;
            this.selectionLength = editorElement.EditorContentElement.TextBoxItem.SelectionLength;
            if (e.KeyCode == Keys.Return && e.Modifiers != Keys.Control)
            {
                base.OnKeyDown(e);
            }
            else
            {
                if (e.KeyCode != Keys.Escape)
                {
                    return;
                }
                base.OnKeyDown(e);
                e.Handled = true;
            }
        }