Software Development Network>> Visual C#>> How to change the backcolor of subitems in a listview programmatically?
I found the problem.
I forgot to set the UseItemStyleForSubItems to false.
thanks.
I am meeting this problem now.
The solution can work fine if the listview1.Items[0].SubItems[0].Text != string.empty.
However, if the text of subitem is empty, the BackColor = Color.LightBlue; can't work.
I don't know why
Can anybody give me some advice
How to change the backcolor of subitems in a listview programmatically?
Subi
I found the problem.
I forgot to set the UseItemStyleForSubItems to false.
thanks.
Peter Johnston
I am meeting this problem now.
The solution can work fine if the listview1.Items[0].SubItems[0].Text != string.empty.
However, if the text of subitem is empty, the BackColor = Color.LightBlue; can't work.
I don't know why
Can anybody give me some advice
thanks.
Shawnee1111
listView1.Items[0].BackColor = Color.LightBlue;
Similar effect will happen if you changed the BackColor of a SubItem:
listView1.Items[0].SubItems[0].BackColor = Color.LightBlue;
You can loop through it to change the colors in alternating way.
Regards,
-chris