ListView text line color.

  • Thread starter Thread starter Larry Hilley
  • Start date Start date
L

Larry Hilley

Hi, I seem to get stuck on what should be easy things to do!

I am adding text lines to a listview. Some lines need to be read, and then
most of the others are black.

How do I control the color of the line I am adding? Or change it after I
have added it?

Larry Hilley
 
Larry said:
Hi, I seem to get stuck on what should be easy things to do!

I am adding text lines to a listview. Some lines need to be read, and then
most of the others are black.

How do I control the color of the line I am adding? Or change it after I
have added it?

Larry Hilley


ListViewItem item = new ListViewItem(new string[]{"aa","bb"});
item.BackColor = Color.Red;
listView1.Items.Add(item);

item = new ListViewItem(new string[]{"cc","dd"});
item.BackColor = Color.FromArgb(0,0,0);
item.ForeColor = Color.White;
listView1.Items.Add(item);
 
* "Larry Hilley said:
Hi, I seem to get stuck on what should be easy things to do!

I am adding text lines to a listview. Some lines need to be read, and then
most of the others are black.

How do I control the color of the line I am adding? Or change it after I
have added it?

Have a look at the item's 'ForeColor' and 'BackColor' properties.
 
Back
Top