C#,silverlight中 将颜色字符串的RRGGBB转换成为颜色

来源:互联网 发布:斗牛辅助器开挂软件 编辑:程序博客网 时间:2024/06/11 06:18
private Color ReturnColorFromString(string color)
        {
            
string alpha = color.Substring(02);
            
string red = color.Substring(22);
            
string green = color.Substring(42);
            
string blue = color.Substring(62);

            
byte alphaByte = Convert.ToByte(alpha, 16);
            
byte redByte = Convert.ToByte(red, 16);
            
byte greenByte = Convert.ToByte(green, 16);
            
byte blueByte = Convert.ToByte(blue, 16);
            
return Color.FromArgb(alphaByte, redByte, greenByte, blueByte);
        }
0 0
原创粉丝点击