Change textColor in list view item programmatically

后端 未结 3 703
孤街浪徒
孤街浪徒 2021-01-29 13:49

I want to do something like this:

 textLabel_inCell.TextColor = Color.Black;

but Visual Studio shows an error:

\"textLabel_inCell doesn

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-29 14:13

    Simply, you can try this:

    listView1.Items[0].SubItems[0].BackColor= Color.Violet;

    Just do your own customization stuff for item index (0) as your need.

    I hope this can help you bro ^_^

    * More Clarifying * I meant this brothers,

    and here you the code:

        private void button1_Click(object sender, EventArgs e)
        {
            listView1.Items[2].BackColor = Color.Red;
        }
    

提交回复
热议问题