示例#1
0
 protected override void Hide()
 {
     if (this.EditControl != null)
     {
         this.Text = this.EditControl.Text;
         this.EditControl.ValueChanged -= new EventHandler(this.OnValueChanged);
         this.EditControl.Hide();
     }
     base.Hide();
     this.EditControl = null;
 }
示例#2
0
 protected override void Click(int yOffset, int parentWidth)
 {
     if (this.Enabled)
     {
         if (this.EditControl != null)
         {
             this.EditControl.Focus();
             this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name));
         }
         else
         {
             base.DisableEvents = true;
             DVTextBox control = base.Parent.GetControl(typeof(DVTextBox)) as DVTextBox;
             if (control != null)
             {
                 control.LineAlign          = base.LineAlign;
                 control.TextBox.Font       = base.TextFont;
                 control.TextBox.ReadOnly   = this.ReadOnly;
                 control.TextBox.Text       = this.Text;
                 control.TextBox.ScrollBars = this.ScrollBars;
                 if (control.TextBox.Multiline != this.MultiLine)
                 {
                     control.TextBox.Multiline = this.MultiLine;
                 }
                 if (control.TextBox.TextAlign != base.TextAlign)
                 {
                     control.TextBox.TextAlign = base.TextAlign;
                 }
                 control.ItemBorder           = base.ItemBorder;
                 control.BorderStyle          = this.Border ? BorderStyle.FixedSingle : BorderStyle.None;
                 control.TextBox.MaxLength    = this.MaxLength;
                 control.TextBox.PasswordChar = this.PasswordChar;
                 if (control.TextBox.WordWrap != this.WordWrap)
                 {
                     control.TextBox.WordWrap = this.WordWrap;
                 }
                 if (this.SelectionStart < 0)
                 {
                     control.TextBox.SelectionStart = control.Text.Length;
                 }
                 else
                 {
                     control.TextBox.SelectionStart  = this.SelectionStart;
                     control.TextBox.SelectionLength = this.SelectionLength;
                 }
                 this.EditControl = control;
                 this.EditControl.ValueChanged += new EventHandler(this.OnValueChanged);
                 this.EditControl.Bounds        = this.GetActivePartBounds(yOffset);
                 base.DisableEvents             = false;
                 this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name));
                 base.DisableEvents = true;
                 if (this.EditControl != null)
                 {
                     this.EditControl.Show();
                     this.EditControl.Focus();
                 }
             }
             base.DisableEvents = false;
             base.Click(yOffset, parentWidth);
         }
     }
 }
示例#3
0
 protected override void Hide()
 {
     if (this.EditControl != null)
     {
         this.Text = this.EditControl.Text;
         this.EditControl.ValueChanged -= new EventHandler(this.OnValueChanged);
         this.EditControl.Hide();
     }
     base.Hide();
     this.EditControl = null;
 }
示例#4
0
文件: ItemLink.cs 项目: windygu/haina
 protected override void Click(int yOffset, int parentWidth)
 {
     if ((base.Parent != null) && this.Enabled)
     {
         if (!this.m_Clicking)
         {
             this.m_Clicking = true;
             base.Parent.Invalidate();
             this.OnGotFocus(this, new ItemEventArgs());
         }
         else if (this.ButtonLike)
         {
             this.OnClicked(this, new ItemEventArgs(this, 0, base.Name));
         }
         else
         {
             Point lastMousePosition = base.Parent.LastMousePosition;
             if (this.GetActivePartBoundsLink(yOffset).Contains(base.Parent.LastMousePosition.X, base.Parent.LastMousePosition.Y))
             {
                 this.Hide();
                 this.OnClicked(this, new ItemEventArgs(this, 0, base.Name));
             }
             else if (this.m_Editable)
             {
                 if (base.EditControl != null)
                 {
                     base.EditControl.Focus();
                     this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name));
                 }
                 else
                 {
                     base.DisableEvents = true;
                     DVTextBox control = base.Parent.GetControl(typeof(DVTextBox)) as DVTextBox;
                     if (control != null)
                     {
                         control.TextBox.Font       = base.TextFont;
                         control.TextBox.ReadOnly   = base.ReadOnly;
                         control.TextBox.Text       = this.Text;
                         control.TextBox.ScrollBars = base.ScrollBars;
                         if (control.TextBox.Multiline != base.MultiLine)
                         {
                             control.TextBox.Multiline = base.MultiLine;
                         }
                         if (control.TextBox.TextAlign != base.TextAlign)
                         {
                             control.TextBox.TextAlign = base.TextAlign;
                         }
                         control.ItemBorder           = base.ItemBorder;
                         control.TextBox.BorderStyle  = base.Border ? BorderStyle.FixedSingle : BorderStyle.None;
                         control.TextBox.MaxLength    = base.MaxLength;
                         control.TextBox.PasswordChar = base.PasswordChar;
                         if (control.TextBox.WordWrap != base.WordWrap)
                         {
                             control.TextBox.WordWrap = base.WordWrap;
                         }
                         if (base.SelectionStart < 0)
                         {
                             control.TextBox.SelectionStart = control.Text.Length;
                         }
                         else
                         {
                             control.TextBox.SelectionStart  = base.SelectionStart;
                             control.TextBox.SelectionLength = base.SelectionLength;
                         }
                         base.EditControl = control;
                         base.EditControl.ValueChanged += new EventHandler(this.OnValueChanged);
                         base.EditControl.Bounds        = this.GetActivePartBounds(yOffset);
                         base.DisableEvents             = false;
                         this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name));
                         base.DisableEvents = true;
                         if (base.EditControl != null)
                         {
                             base.EditControl.Show();
                             base.EditControl.Focus();
                         }
                     }
                     base.DisableEvents = false;
                 }
             }
         }
     }
 }
示例#5
0
 protected override void Click(int yOffset, int parentWidth)
 {
     if (this.Enabled)
     {
         if (this.EditControl != null)
         {
             this.EditControl.Focus();
             this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name));
         }
         else
         {
             base.DisableEvents = true;
             DVTextBox control = base.Parent.GetControl(typeof(DVTextBox)) as DVTextBox;
             if (control != null)
             {
                 control.LineAlign = base.LineAlign;
                 control.TextBox.Font = base.TextFont;
                 control.TextBox.ReadOnly = this.ReadOnly;
                 control.TextBox.Text = this.Text;
                 control.TextBox.ScrollBars = this.ScrollBars;
                 if (control.TextBox.Multiline != this.MultiLine)
                 {
                     control.TextBox.Multiline = this.MultiLine;
                 }
                 if (control.TextBox.TextAlign != base.TextAlign)
                 {
                     control.TextBox.TextAlign = base.TextAlign;
                 }
                 control.ItemBorder = base.ItemBorder;
                 control.BorderStyle = this.Border ? BorderStyle.FixedSingle : BorderStyle.None;
                 control.TextBox.MaxLength = this.MaxLength;
                 control.TextBox.PasswordChar = this.PasswordChar;
                 if (control.TextBox.WordWrap != this.WordWrap)
                 {
                     control.TextBox.WordWrap = this.WordWrap;
                 }
                 if (this.SelectionStart < 0)
                 {
                     control.TextBox.SelectionStart = control.Text.Length;
                 }
                 else
                 {
                     control.TextBox.SelectionStart = this.SelectionStart;
                     control.TextBox.SelectionLength = this.SelectionLength;
                 }
                 this.EditControl = control;
                 this.EditControl.ValueChanged += new EventHandler(this.OnValueChanged);
                 this.EditControl.Bounds = this.GetActivePartBounds(yOffset);
                 base.DisableEvents = false;
                 this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name));
                 base.DisableEvents = true;
                 if (this.EditControl != null)
                 {
                     this.EditControl.Show();
                     this.EditControl.Focus();
                 }
             }
             base.DisableEvents = false;
             base.Click(yOffset, parentWidth);
         }
     }
 }