Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change color line in listview

How change color line in listview . for example if line == 4 then line is red

like image 638
Igor Avatar asked Dec 11 '22 21:12

Igor


1 Answers

If you want to go through the whole list and colour each item conditionally, then you can use:

foreach (ListViewItem lvw in myListView.Items)
{
    if (lvw.SubItems[x].ToString() == "True")
    {
        lvw.BackColor = Color.Red;
    }
}

Or if you always want to color the item at index 4:

myListView.Items[4].BackColor = Color.Red;
like image 185
r3su Avatar answered Feb 02 '23 09:02

r3su