Hi ZhangZQ,
Do you mean the ListViewItem.BackColor property?
bool swap = false;
foreach(ListViewItem l in lv.Items)
{
if(swap)
{
l.BackColor = SystemColors.ControlText;
l.ForeColor = SystemColors.ControlLightLight;
}
swap = !swap;
}
This will cause every other line to be reverse colored.
Note that selected lines won't be affected.
If you want to set different colors in different columns you need to set UseItemStyleForSubItems = false on the listviewitems.
--
Happy coding!
Morten Wennevik [C# MVP]