且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

列表视图控件和颜色

更新时间:2023-02-06 10:52:12

private void Form1_Load (对象发送方,EventArgs e)
{
listView1.Items.Add(红色"); 黄色");

listView1.Items [0] .BackColor = Color.Red;
listView1.Items [1] .BackColor = Color.Green;
listView1.Items [2] .BackColor = Color.Yellow; >}

这些项目似乎不会改变其背景颜色.
您怎么会遇到这种情况?

private void Form1_Load(object sender, EventArgs e)
        {
            listView1.Items.Add("red");
            listView1.Items.Add("greend");
            listView1.Items.Add("yellow");

            listView1.Items[0].BackColor = Color.Red;
            listView1.Items[1].BackColor = Color.Green;
            listView1.Items[2].BackColor = Color.Yellow;
        }

It seems that the items will not change their background color..
How can you get into this situation?