public FilterControl() { InitializeComponent(); var height = Math.Max(FilterText.Height, FilterText.GetPreferredSize(new Size(999, 999)).Height); MinimumSize = new Size(0, height); MaximumSize = new Size(999999, height); Height = height; }