DiverDan
Contributor
Is it possible to add horizontal scroll bars to a dropdown list combobox when they are needed?
Thanks
Thanks
comboBox1.Items.Add("hello world");
comboBox1.Items.Add("blah");
comboBox1.Items.Add("Show me a sane man and I will cure him for you");
Graphics g = comboBox1.CreateGraphics();
float maxSize = -1f;
SizeF size = new SizeF();
foreach(object o in comboBox1.Items)
{
size = g.MeasureString(o.ToString(), comboBox1.Font);
if(size.Width > maxSize) maxSize = size.Width;
}
g.Dispose();
comboBox1.DropDownWidth = (int)maxSize;