【发布时间】:2012-10-20 06:49:10
【问题描述】:
我有一个列表框,对于每个坐标我需要有不同的颜色。例如。
23,34 //red background
56,78 //green background
90,2 // yellow background
代码:
for (int i = 0; i < il_kl; i++)
{
int il_pkt = Klastry[i].Punkty.Count;
string color = lista_kolor[i];
Brush mybrush = (Brush)new BrushConverter().ConvertFromString(color);
for (int j = 0; j < il_pkt; j++)
{
x = Klastry[i].Punkty[j].X;
y = Klastry[i].Punkty[j].Y;
_mn.kolekcje_wsp.Items.Add(x + " , " + y);
_mn.kolekcje_wsp.Foreground = mybrush;
}
}
我现在使用Foreground,但是如何更改每个坐标的Background 颜色?
【问题讨论】: