protected override void LayoutControl(Rectangle bounds) { Control.Location = bounds.Location; int textBoxWidth = bounds.Width - (Control.Width - Control.DisplayRectangle.Width); DAE.Client.Controls.Range range = new DAE.Client.Controls.Range(Math.Min(textBoxWidth, base.GetControlNaturalWidth()), textBoxWidth); DateLookupControl.TextBox.WidthRange.Range = range; if (DateLookupControl.TextBox.Width > range.Maximum) { DateLookupControl.TextBox.Width = range.Maximum; } if (DateLookupControl.TextBox.Width < range.Minimum) { DateLookupControl.TextBox.Width = range.Minimum; } }
// ControlElement protected override void LayoutControl(Rectangle bounds) { Control.Location = bounds.Location; Control.Height = bounds.Height; if (_height == 1) { // Only range the width if it is a single line textbox DAE.Client.Controls.Range range = new DAE.Client.Controls.Range(Math.Min(bounds.Width, GetControlNaturalWidth()), bounds.Width); Control.Width = Math.Min(range.Maximum, Math.Max(range.Minimum, Control.Width)); ((DAE.Client.Controls.IWidthRange)Control).WidthRange.Range = range; } else { ((DAE.Client.Controls.IWidthRange)Control).WidthRange.Range = new DAE.Client.Controls.Range(bounds.Width, bounds.Width); Control.Width = bounds.Width; } }