纳金网

标题: 16进制颜色值转rgb [打印本页]

作者: 烟雨    时间: 2016-1-18 05:21
标题: 16进制颜色值转rgb
  rgb = "FFFFFF";

            var result = Regex.Matches(rgb, @"\w{2}");

            List<string> re = new List<string>();

            foreach (Match item in result)
            {
                re.Add(item.Value);
            }

            byte r = (byte)Convert.ToByte(re[0], 16);
            byte g = (byte)Convert.ToByte(re[1], 16);
            byte b = (byte)Convert.ToByte(re[2], 16);

            Color32 color = new Color32(r, g, b, 255);






欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5