namespace System.Windows.Forms { public class ToolStripTextBox : ToolStripItem { private CustomControls.ToolStripTextBox textbox; public override string Text { get => textbox.Text; set => textbox.Text = value; } public bool AcceptsReturn { get => textbox.AcceptsReturn; set => textbox.AcceptsReturn = value; } public bool AcceptsTab { get => textbox.AcceptsTab; set => textbox.AcceptsTab = value; } public bool ReadOnly { get => textbox.IsReadOnly; set => textbox.IsReadOnly = value; } private HorizontalAlignment textBoxTextAlign; public HorizontalAlignment TextBoxTextAlign { get => textBoxTextAlign; set { textBoxTextAlign = value; textbox.HorizontalContentAlignment = value switch { HorizontalAlignment.Center => Windows.HorizontalAlignment.Center, HorizontalAlignment.Right => Windows.HorizontalAlignment.Right, _ => Windows.HorizontalAlignment.Left }; } } public int MaxLength { get => textbox.MaxLength; set => textbox.MaxLength = value; } public override void ApplyStyle(ToolStripProfessionalRenderer r) { textbox.Resources["TextBox.ControlText"] = r.Foreground; textbox.Resources["TextBox.Static.Background"] = r.TextBoxStaticBackground; textbox.Resources["TextBox.Static.Border"] = r.ComboBoxStaticBorder; textbox.Resources["TextBox.MouseOver.Border"] = r.ComboBoxMouseOverBorder; textbox.Resources["TextBox.Disabled.Border"] = r.ComboBoxDisabledBorder; } public ToolStripTextBox() { textbox = new(); SetControl(textbox); textbox.VerticalAlignment = VerticalAlignment.Center; textbox.TextChanged += (s, e) => OnTextChanged(e); AutoSize = false; } } }