text of different colors in listview

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

When I add to a listview, can the text I have be of different colors?

For example, I want to add these two lines to my list view:

"This is my program"
"This is my other program"

Can I add it with "This is" written in red text while "program" is written
in yellow text? And then do the same thing with the second line?

Thanks.
 
You can not do it out of the box. However, you can override the OnPaint
method, or attach to the Paint event on the TreeView and custom paint the
item yourself, applying whatever colors you wish.

Hope this helps.
 
Back
Top