I have a few issues/questions regarding ListBoxes. I have to admit it is an element I never worked with before so I need a few pointers,
In the software I am working on, I read a tabulated text file and fill a ListBox with that data. It has about 50 columns and at least 100 lines. Now for my questions:
Is there a way to set all columns width with one command instead of looping through each of them
Same question but with Sortable/NotSortable
I also tried to find a way to put color in the headers but could not find anything… Anyway to do it? What about color in the columns?
Also, when I filled the headers, I see the first 10 columns as they should, the 11th header is just about 10 pixels wide, and then, the next column header is the last item. But when I mouse over the headers, the missing one appears where they should… Any ideas why?
Sure. Use the ListBox.ColumnWidths property. Just set it to a string containing the widths for each column.
No.
Again, no for a global action. For the cells, you’d need to set the ForeColor and use the CellBackgroundPaint event to color the rect.
A couple of ideas here. When you specified the columns have you given all of them a default size? If the total is more than the width of the listbox, is the horizontal scrollbar enabled? If not, the system may try to fit all of the columns in by reducing the sizes of the later columns.