开发者

Using printf to print a COLORREF type variable

I need to 开发者_高级运维print a variable which is a COLORREF.


You might also want to break it up into the individual RGB components:

printf("R: %i, G: %i, B: %i", GetRValue(color), GetGValue(color), GetBValue(color));

this would give you something like:

R: 255, G: 150, B: 75


A COLORREF is just an integer containing an RGB value. You can print a hex representation this way:

printf("%06X", color);

Note that the order of values is bbggrr, so it will look different from the usual rrggbb format.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜