Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of
        /// </summary>
        /// <param name="hostedControl"></param>
        public RadTextBoxItem(Control hostedControl)
            : base(hostedControl)
        {
            HostedTextBoxBase textBox = hostedControl as HostedTextBoxBase;

            Debug.Assert(textBox != null, "Invalid hosted control for RadTextBoxItem.");

            if (this.UseGenericBorderPaint)
            {
                textBox.BorderStyle = BorderStyle.Fixed3D;
            }
            else
            {
                textBox.BorderStyle = BorderStyle.None;
            }

            textBox.Enter          += new EventHandler(TextBoxControl_Enter);
            textBox.Leave          += new EventHandler(TextBoxControl_Leave);
            textBox.TabStopChanged += new EventHandler(TextBoxControl_TabStopChanged);

            textBox.AcceptsTabChanged    += new EventHandler(TextBoxControl_AcceptsTabChanged);
            textBox.HideSelectionChanged += new EventHandler(TextBoxControl_HideSelectionChanged);
            textBox.ModifiedChanged      += new EventHandler(TextBoxControl_ModifiedChanged);
            textBox.MultilineChanged     += new EventHandler(TextBoxControl_MultilineChanged);
            textBox.ReadOnlyChanged      += new EventHandler(TextBoxControl_ReadOnlyChanged);
            textBox.TextAlignChanged     += new EventHandler(TextBoxControl_TextAlignChanged);
            textBox.TextChanged          += new EventHandler(TextBoxControl_TextChanged);
            textBox.KeyDown        += new KeyEventHandler(TextBoxControl_KeyDown);
            textBox.KeyPress       += new KeyPressEventHandler(TextBoxControl_KeyPress);
            textBox.KeyUp          += new KeyEventHandler(TextBoxControl_KeyUp);
            textBox.PreviewKeyDown += new PreviewKeyDownEventHandler(TextBoxControl_PreviewKeyDown);
        }
Esempio n. 2
0
        private void textBox_Disposed(object sender, EventArgs e)
        {
            HostedTextBoxBase hostedTextBoxBase = (HostedTextBoxBase)sender;

            hostedTextBoxBase.Disposed -= new EventHandler(this.textBox_Disposed);
            bool isHandleCreated = hostedTextBoxBase.IsHandleCreated;

            this.disposedTextBoxValues.Add("Text", isHandleCreated ? (object)this.TextBoxControl.Text : (object)string.Empty);
            this.disposedTextBoxValues.Add("TabStop", (object)(bool)(isHandleCreated ? (this.TextBoxControl.TabStop ? 1 : 0) : 1));
            this.disposedTextBoxValues.Add("AcceptsReturn", (object)(bool)(isHandleCreated ? (this.TextBoxControl.AcceptsReturn ? 1 : 0) : 0));
            this.disposedTextBoxValues.Add("AcceptsTab", (object)(bool)(isHandleCreated ? (this.TextBoxControl.AcceptsTab ? 1 : 0) : 1));
            this.disposedTextBoxValues.Add("CharacterCasing", (object)(CharacterCasing)(isHandleCreated ? (int)this.TextBoxControl.CharacterCasing : 0));
            this.disposedTextBoxValues.Add("HideSelection", (object)(bool)(isHandleCreated ? (this.TextBoxControl.HideSelection ? 1 : 0) : 0));
            this.disposedTextBoxValues.Add("MaxLength", (object)(isHandleCreated ? this.TextBoxControl.MaxLength : (int)ushort.MaxValue));
            this.disposedTextBoxValues.Add("Modified", (object)(bool)(isHandleCreated ? (this.TextBoxControl.Modified ? 1 : 0) : 0));
            this.disposedTextBoxValues.Add("Multiline", (object)(bool)(isHandleCreated ? (this.TextBoxControl.Multiline ? 1 : 0) : 0));
            this.disposedTextBoxValues.Add("PasswordChar", (object)(char)(isHandleCreated ? (int)this.TextBoxControl.PasswordChar : 42));
            this.disposedTextBoxValues.Add("ReadOnly", (object)(bool)(isHandleCreated ? (this.TextBoxControl.ReadOnly ? 1 : 0) : 0));
            this.disposedTextBoxValues.Add("ScrollBars", (object)(ScrollBars)(isHandleCreated ? (int)this.TextBoxControl.ScrollBars : 0));
            this.disposedTextBoxValues.Add("SelectedText", isHandleCreated ? (object)this.TextBoxControl.SelectedText : (object)string.Empty);
            this.disposedTextBoxValues.Add("SelectionLength", (object)(isHandleCreated ? this.TextBoxControl.SelectionLength : 0));
            this.disposedTextBoxValues.Add("SelectionStart", (object)(isHandleCreated ? this.TextBoxControl.SelectionStart : 0));
            this.disposedTextBoxValues.Add("ShortcutsEnabled", (object)(bool)(isHandleCreated ? (this.TextBoxControl.ShortcutsEnabled ? 1 : 0) : 1));
            this.disposedTextBoxValues.Add("TextAlign", (object)(HorizontalAlignment)(isHandleCreated ? (int)this.TextBoxControl.TextAlign : 0));
            this.disposedTextBoxValues.Add("WordWrap", (object)(bool)(isHandleCreated ? (this.TextBoxControl.WordWrap ? 1 : 0) : 0));
            this.disposedTextBoxValues.Add("UseGenericBorderPaint", (object)(bool)(isHandleCreated ? (this.TextBoxControl.UseGenericBorderPaint ? 1 : 0) : 0));
        }
Esempio n. 3
0
        public RadTextBoxItem(Control hostedControl)
            : base(hostedControl)
        {
            HostedTextBoxBase hostedTextBoxBase = hostedControl as HostedTextBoxBase;

            if (this.UseGenericBorderPaint)
            {
                hostedTextBoxBase.BorderStyle = BorderStyle.Fixed3D;
            }
            else
            {
                hostedTextBoxBase.BorderStyle = BorderStyle.None;
            }
            hostedTextBoxBase.Enter                += new EventHandler(this.TextBoxControl_Enter);
            hostedTextBoxBase.Leave                += new EventHandler(this.TextBoxControl_Leave);
            hostedTextBoxBase.TabStopChanged       += new EventHandler(this.TextBoxControl_TabStopChanged);
            hostedTextBoxBase.AcceptsTabChanged    += new EventHandler(this.TextBoxControl_AcceptsTabChanged);
            hostedTextBoxBase.HideSelectionChanged += new EventHandler(this.TextBoxControl_HideSelectionChanged);
            hostedTextBoxBase.ModifiedChanged      += new EventHandler(this.TextBoxControl_ModifiedChanged);
            hostedTextBoxBase.MultilineChanged     += new EventHandler(this.TextBoxControl_MultilineChanged);
            hostedTextBoxBase.ReadOnlyChanged      += new EventHandler(this.TextBoxControl_ReadOnlyChanged);
            hostedTextBoxBase.TextAlignChanged     += new EventHandler(this.TextBoxControl_TextAlignChanged);
            hostedTextBoxBase.TextChanged          += new EventHandler(this.TextBoxControl_TextChanged);
            hostedTextBoxBase.KeyDown              += new KeyEventHandler(this.TextBoxControl_KeyDown);
            hostedTextBoxBase.KeyPress             += new KeyPressEventHandler(this.TextBoxControl_KeyPress);
            hostedTextBoxBase.KeyUp                += new KeyEventHandler(this.TextBoxControl_KeyUp);
            hostedTextBoxBase.PreviewKeyDown       += new PreviewKeyDownEventHandler(this.TextBoxControl_PreviewKeyDown);
            hostedTextBoxBase.MouseEnter           += new EventHandler(this.TextBoxControl_MouseEnter);
            hostedTextBoxBase.MouseLeave           += new EventHandler(this.textBoxItem_MouseLeave);
            hostedTextBoxBase.Disposed             += new EventHandler(this.textBox_Disposed);
        }
        private void OnTextBoxItemKeyUp(object sender, KeyEventArgs e)
        {
            HostedTextBoxBase textBoxControl = (this.EditorElement as RadTimePickerElement).MaskedEditBox.TextBoxItem.TextBoxControl;
            bool flag1 = textBoxControl.SelectionStart == 0;
            bool flag2 = textBoxControl.Text.Length == textBoxControl.SelectionStart + textBoxControl.SelectionLength;

            if (!this.selectedItemChanged && (flag1 || flag2) && (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right))
            {
                this.OnKeyDown(e);
            }
            this.selectedItemChanged = false;
        }
Esempio n. 5
0
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     if (e.Property == RadItem.TextProperty)
     {
         string str      = (string)e.NewValue;
         string oldValue = (string)e.OldValue;
         if (str == null)
         {
             str = string.Empty;
         }
         if (oldValue == str)
         {
             return;
         }
         if (str == string.Empty)
         {
             int num1 = (int)this.SetValue(RadTextBoxItem.IsNullTextProperty, (object)true);
         }
         else
         {
             int num2 = (int)this.SetValue(RadTextBoxItem.IsNullTextProperty, (object)false);
         }
         if (!this.GetBitState(70368744177664L) && !this.GetBitState(35184372088832L))
         {
             this.BitState[35184372088832L] = true;
             this.TextBoxControl.Text       = str;
             this.BitState[35184372088832L] = false;
         }
         else if (this.GetBitState(70368744177664L) && this.GetBitState(140737488355328L))
         {
             this.TextBoxControl.Text = str;
         }
     }
     else if (e.Property == RadTextBoxItem.NullTextColorProperty)
     {
         HostedTextBoxBase textBoxControl = this.TextBoxControl;
         if (textBoxControl != null)
         {
             textBoxControl.PromptForeColor = this.NullTextColor;
         }
     }
     base.OnPropertyChanged(e);
     if (e.Property != RadElement.RightToLeftProperty)
     {
         return;
     }
     this.TextBoxControl.RightToLeft = this.RightToLeft ? RightToLeft.Yes : RightToLeft.No;
     this.NullText = this.NullText;
 }