/// <summary> /// Adds a control to the TextInputWindow. The control will automatically /// be positioned below the previously-added control. The spacing can be controlled /// through the control's Margin property. /// </summary> /// <remarks> /// If you are adding a control after a label, you may need to adjust /// the label's height. By default it's bigger than usually desired. /// </remarks> /// <param name="control">The control to add</param> public void AddControl(Control control, AboveOrBelow aboveOrBelow = AboveOrBelow.Below) { bool isFirst = (aboveOrBelow == AboveOrBelow.Below && this.ExtraControlsPanel.Controls.Count == 0) || (aboveOrBelow == AboveOrBelow.Above && this.ExtraControlsPanelAbove.Controls.Count == 0) ; if (isFirst) { this.Height += 5; } if (aboveOrBelow == AboveOrBelow.Above) { this.ExtraControlsPanelAbove.Controls.Add(control); } else { // below this.ExtraControlsPanel.Controls.Add(control); } this.Height += control.Height; this.textBox1.Focus(); this.DefaultControlPanel.Location = new Point(0, ExtraControlsPanelAbove.Height); }