How to custom draw selected item rows in Windows List-View Control

How to custom draw selected item rows in Windows List-View Control

Post by yshi » Fri, 07 Jan 2011 01:37:22


I have created NM_CUSTOMDRAW message handler to custom draw List-View
control subitems. It is almost OK. However, I can't custom draw item
which is selected. My custom settings are always ignored and default
white text over blue bkColor is drawn.

Can I have any chance to custom draw selected items?
 
 
 

How to custom draw selected item rows in Windows List-View Control

Post by Wood » Wed, 12 Jan 2011 18:28:58

Yes, you can draw the selected items. There is a sample of this in the
documentation under CustomDrawListView. When you get the NMCUSTOMDRAW
message, you look at the CDIS_SELECTED state. Then change the text and
background colors. to whatever you want. The trick is to do this at
the right draw stage. I don't remember which it is, but you can
quickly tell by experimenting.