开发者

How to draw text in different colors within the same line using GDI functions?

开发者 https://www.devze.com 2023-03-04 14:29 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消