[英]how to add color to sub item in listview? c#
I tried to add text color to any sub item in the listview by the index that the method get from the array 我试图通过方法从数组中获取的索引向列表视图中的任何子项添加文本颜色
for (int i = 0; i < sizes.Length; ++i)
{
if (sizes[i] == 1)
{
Item.SubItems.Add("In Stock");
}
else if (sizes[i] == 0)
{
Item.SubItems.Add("Out Of Stock");
}
else if (sizes[i] == 2)
{
Item.SubItems.Add("Less Than 3");
}
else if (sizes[i] == 5)
{
Item.SubItems.Add("Less Than 5");
}
else if (sizes[i] == 10)
{
Item.SubItems.Add("Less Than 10");
}
}
ProductListView.Items.Add(Item);
}
if the size in stock the subitem color change to green and if the size is out of stock the subitem color will change to red 如果库存尺寸,子项目颜色变为绿色,如果尺寸不足,子项目颜色将变为红色
thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.