如何更改列表中项目的颜色? [英] how to change color of item in the list?
本文介绍了如何更改列表中项目的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改列表中项目的颜色?
how to change color of item in the list?
listView1.Items[1].SubItems.Add("hello");
我该如何将其更改为green
how can i change hello to green
推荐答案
执行以下代码,其中cForeColor,cBackColor和fFont分别是所需的背景色,背景色和字体.
Do something like the code below where cForeColor, cBackColor and fFont are the desired forground color, background color and font respectively.
ListView listView;
ListViewItem item = new ListViewItem("Test");
item.UseItemStyleForSubItems = false;
item.SubItems.Add("Hello", cForeColor, cBackColor, fFont);
另请阅读本文 [
Also read this article[^] for more advanced ideas.
这篇关于如何更改列表中项目的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文