nylon610
nylon610

Reputation: 69

listViewItem.BackColor not working

I'm using OwnerDraw = true, i'm not able to change the BackColor of the item (i've got several SubItems also and ListView is set to Details view).

Upvotes: 3

Views: 3608

Answers (3)

mr.baby123
mr.baby123

Reputation: 2312

Before u edit the style of the ListViewSubItem, Make sure to set the listview UseItemStyleForSubItems property to false:

p_lvi.UseItemStyleForSubItems = false;
p_lvi.SubItems[3 /*use your sub item index*/].BackColor = Color.Yellow;

and that's all... :)

Upvotes: 1

nam.dao90
nam.dao90

Reputation: 11

you can visit: ListViewItem.BackColor Property (MSDN)

I think it help to you

Upvotes: 0

Justin Doyle
Justin Doyle

Reputation: 606

I'm not sure if this will help since the question is a little vague, but if you want to set the BackColor of SubItems you need to set UseItemStyleForSubItems = false on the ListViewItem. OwnerDraw shouldn't make a difference.

Upvotes: 6

Related Questions