I set the DrawMode in my listbox control to OwnerDrawFixed so that I can color some items. When an item is too long to fit in the horizontal space of the list box no horizontal scoll appears.
How can I make the scrollbar appear?
Join Stack Overflow to learn, share knowledge, and build your career.
you should set HorizontalExtent property of listbox in OwnerDrawFixed mode
listBox1.HorizontalExtent = xx; //xx can be maximum size list box item fills
To determine the value that HorizontalExtent should be set to use the following method on the the strings in your list box and get the Width property:
TextRenderer.MeasureText(text, listBox1.font)
Set HorizontalExtent to the largest Width value that MeasureText returns