C# 将uint转换为颜色
如何将C# 将uint转换为颜色,c#,winforms,colors,C#,Winforms,Colors,如何将uint值转换为ARGBSystem.Drawing.Color?我还没有在网上找到这个 我刚刚找到了ARGB touint的方法 我的uint值来自: uint aeroColor; Dwmapi.DwmGetColorizationColor( out aeroColor, out opaque ); uint代表什么?通常,您可以使用以下方法: Color c = Color.FromArgb(intvalue); 使用。但是,这需要的是int,而不是uint。如果您有一个具有相
uint
值转换为ARGBSystem.Drawing.Color
?我还没有在网上找到这个
我刚刚找到了ARGB touint
的方法
我的uint
值来自:
uint aeroColor;
Dwmapi.DwmGetColorizationColor( out aeroColor, out opaque );
uint
代表什么?通常,您可以使用以下方法:
Color c = Color.FromArgb(intvalue);
使用。但是,这需要的是int
,而不是uint
。如果您有一个具有相同内存布局的uint
(与您的情况相同),则以下操作应能正常工作:
uint aeroColor;
Dwmapi.DwmGetColorizationColor(out aeroColor, out opaque);
Color c = Color.FromArgb((int) aeroColor);
为什么不呢?那么什么类型的变量返回它呢?@Victor啊,我明白了。由于格式相同(0xAARRGGBB),您可能只需强制转换结果。