简体   繁体   中英

compact framework C#: listView sub item

I have to change the fore color of Listview Subitem in listview .

I m using WM6 C#, can u plze help me out. Hw can change the colors of Subitems indivudally?

Plz help me...

Thanks in Advance

The only way to do this is to custom draw the items. Christian Helle has an example here (it's way too long to post back here).

I wanted something like this in my app, but Mobile screens are small. It worked better to set the entire ListViewItem 's BackColor property:

private void ChangeLviColor(ListViewItem lvi, Color color) {
  if (lvi.BackColor != color) {
    lvi.BackColor = color;
  }
}

FYI: Both of the links above will take you to some great sample code.

Of special note, be aware of this remark: "If you want to use the same background color for all subitems of an item, set the UseItemStyleForSubItems property to true. This will cause the colors and fonts specified for the item to be used for all subitem text."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM