How to draw text in different colors within the same line using GDI functions?
I would like开发者_如何学编程 to draw text in different colors within the same line using GDI functions. For example, In the sentence "There are 2 updates available", I want to highlight the number "2" in the sentence with a different color. There seems to be no GDI functions which is able to do the job(TextOut, DrawText can only draw text in the same color each time). How do I do? Thank you.
You have to write "There are" to DC with textout (or drawtext) and then change the DC pen or call SetDCPenColor before writing "2" then change pen back and continue to write in org color.
精彩评论