ListView Color
-
Playing with the ListView to try to get colored backgrounds.
ListViewItem lviGrossMargin = new ListViewItem(strListViewItem); lvOptions.Items.Add(lviGrossMargin); lviGrossMargin.SubItems[0].BackColor = System.Drawing.Color.Wheat; lviGrossMargin.SubItems[1].BackColor = System.Drawing.Color.SpringGreen; lviGrossMargin.SubItems[2].BackColor = System.Drawing.Color.YellowGreen;
If I set lvOptions.Background, I color the entire background the identified color. But coding as above, I get the same result. Setting SubItems[0] to Wheat sets all SubItems. Setting SubItems[1] or [2] does nothing. Playing with the SubItems[n].Text does apply the expected text in each column. If I play with ForeColor, same as BackColor occurs. [0] is recognized and applies it to all SubItems. It is only the colors that don't seem to work. Is there a step I skipped that has to be done before manipulating colors or is it a feature that doesn't work correctly in VS Studio 2003?
-
Playing with the ListView to try to get colored backgrounds.
ListViewItem lviGrossMargin = new ListViewItem(strListViewItem); lvOptions.Items.Add(lviGrossMargin); lviGrossMargin.SubItems[0].BackColor = System.Drawing.Color.Wheat; lviGrossMargin.SubItems[1].BackColor = System.Drawing.Color.SpringGreen; lviGrossMargin.SubItems[2].BackColor = System.Drawing.Color.YellowGreen;
If I set lvOptions.Background, I color the entire background the identified color. But coding as above, I get the same result. Setting SubItems[0] to Wheat sets all SubItems. Setting SubItems[1] or [2] does nothing. Playing with the SubItems[n].Text does apply the expected text in each column. If I play with ForeColor, same as BackColor occurs. [0] is recognized and applies it to all SubItems. It is only the colors that don't seem to work. Is there a step I skipped that has to be done before manipulating colors or is it a feature that doesn't work correctly in VS Studio 2003?
Have you tried setting the UseItemStyleForSubItems property of the ListViewItem to false? Jared Parsons jaredp@beanseed.org http://spaces.msn.com/members/jaredp/
-
Have you tried setting the UseItemStyleForSubItems property of the ListViewItem to false? Jared Parsons jaredp@beanseed.org http://spaces.msn.com/members/jaredp/