How do I change the color of the columns in a list view control (detail view).
Thanks
Printable View
How do I change the color of the columns in a list view control (detail view).
Thanks
You have two choices. The easy way is to set the UseItemStyleForSubItems property of each ListViewItem to False then set the BackColor of each ListViewSubItem in that column. The drawback is that if there is any space in the ListView the column will not be coloured. To do it properly you would have to draw the ListView yourself. There are ready-made controls or information on how to do it yourself at The Code Project or other places.
I can change each individual item that i add to the list but the main colum (the first one in the list at the very top) I cannot figure out how to change.
Do you mean the first item in the list or the column header? If you mean the header then that would definitely require owner-drawing, perhaps even APIs to get to the underlying Win32 control. Have you read the stuff on The Code Project about owner-drawing ListViews?
this should get you started ... Customizing the header control in a ListView
:wave:
Good old Code Project. I wish I'd thought of that. ;)