Converting uint to Color

c#, colors, winforms

Solution

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);

Problem

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 ); ```

Original source