简体   繁体   中英

Listview Subitems Forecolor

How to change forecolor for all subitems in listview .

I have 2 columns, I need column 1 white, and second (subitems) column gray color.

tried this after setting gray color from items & subitems UI,

listView1.Items[0].UseItemStyleForSubItems = false;

but not working for items[1] .

Any solutions?

Thanks

I have checked that code. It is working. I think it will work for you too. A detail discussion is available in the given link. Thank you.

for (int i = 0; i < listView1.Items.Count; i++)
{
   listView1.Items[i].UseItemStyleForSubItems = false;
   listView1.Items[i].SubItems[0].ForeColor = System.Drawing.Color.White;
   listView1.Items[i].SubItems[1].ForeColor = System.Drawing.Color.Gray;
}

Addional Information: There is a very similar question is available on that link. Please check the provided link: How can I change the ForeColor of a single sub item in a ListView control?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM