开发者

listViewItem.BackColor not working

开发者 https://www.devze.com 2023-03-15 19:00 出处:网络
I\'m using OwnerDraw = true, i\'m not able t开发者_开发百科o change the BackColor of the item (i\'ve got several SubItems also and ListView is set to Details view).I\'m not sure if this will help sinc

I'm using OwnerDraw = true, i'm not able t开发者_开发百科o change the BackColor of the item (i've got several SubItems also and ListView is set to Details view).


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.


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... :)


you can visit: ListViewItem.BackColor Property (MSDN)

I think it help to you

0

精彩评论

暂无评论...
验证码 换一张
取 消