Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting uint to Color

How can I convert an uint value to an ARGB System.Drawing.Color? I haven't found this on the internet yet...

I have just found methods for ARGB to uint.

My uint value came from:

uint aeroColor;
Dwmapi.DwmGetColorizationColor( out aeroColor, out opaque );
like image 414
Victor Avatar asked Mar 05 '26 21:03

Victor


1 Answers

What does the uint represent? In general, you can use this:

Color c = Color.FromArgb(intvalue);

Using the appropriate overload. However, this expects an int, not a uint. If you have a uint with the same memory layout (as in your case) then the following should work:

uint aeroColor;
Dwmapi.DwmGetColorizationColor(out aeroColor, out opaque);
Color c = Color.FromArgb((int) aeroColor);
like image 88
Konrad Rudolph Avatar answered Mar 08 '26 09:03

Konrad Rudolph