Пример #1
0
        private void FitDropDownToContent()
        {
            Size preferedSize = listBox.GetPreferredSize(new Size(Width, 600));
            int  width        = Math.Max(preferedSize.Width, Width);
            int  height       = Math.Max(96, preferedSize.Height);

            dropdown.MaximumSize = new Size(Width, height + 20);
            dropdown.ClientSize  = new Size(width, height);
            listBox.Refresh();
        }