重複の可能性:
ListBox 項目の背景色 (winform)
座標ごとに異なる色が必要な ListBox があります。元。
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