Invert Text Color depending on BackColor
问题 I have a ProgressBar control like the following two: The first is painted properly. As you can see, the second only has one 0, it's supposed to have two but the other cannot be seen because ProgressBar's ForeColor is the same as the TextColor . Is there a way I can paint the text in black when the ProgressBar below is painted in Lime and paint the text in Lime when the background is black? 回答1: You can first draw the background and text, then draw the foreground lime rectangle using PatBlt