开发者

Using printf to print a COLORREF type variable

开发者 https://www.devze.com 2023-02-07 05:25 出处:网络
I need to 开发者_高级运维print a variable which is a COLORREF. You might also want to break it up into the individual RGB components:

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

精彩评论

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