1、十进制转为十六进制:
int a = 100;
String strA = a.ToString(“x8”);
2、十六进制转为十进制:
int b= Int32.Parse(“266”, System.Globalization.NumberStyles.HexNumber);
3、RGB颜色转成UInt(colorChoosed 表示RGB形式的颜色)
int r = a.R;
int g = a.G;
int b = a.B;
UInt32 a = (uint)(((uint)b << 16) | (ushort)(((ushort)g << 8) | r));
4、UInt转成RGB颜色
int R = 0xFF & a;
int G = 0xFF00 & a ;
G >>= 8;
int B = 0xFF0000 & a;
B >>= 16;
Color acover = Color.FromArgb(R, G, B);
C#net常用列表
最新推荐文章于 2024-06-22 15:51:58 发布