Besides the options from Solution 1, you can do it inside your custom draw handler by drawing the text of cells that match the criteria there and returning
CDRF_SKIPDEFAULT
or use owner drawing to draw all cells yourself (implementing
DrawItem()
).
But both methods require code to draw the cell content in a similar way like Windows does. The resulting code can become quite large when all possible options should be supported: Coloring (selected, hot, inactive, background), text alignment, images (check boxes, icons) and style (classic or themed).
For a simple implementation perform these steps:
- Get the cell rect
- Clear cell by calling FillSolidRect() with background color
- Subtract cell text spacing of 6 pixels from left and right
- Draw the text using format flags
DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER
Because you want text with multiple colors, you need to call
DrawText()
multiple times and can't use the alignment and end ellipsis flags but must simulate these formats too.