Silverlight ToArgb FromArgb

ToArgb

Color c = Colors.Yellow;
string s = c.ToString().TrimStart('#');
int argb = Int32.Parse(s.ToString(), System.Globalization.NumberStyles.HexNumber);


 

FromArgb

Color.FromArgb(BitConverter.GetBytes(intVal));   
 
// or if that doesn't work  
var bytes = BitConverter.GetBytes(intVal);  
Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]);

posted @ 2012-04-07 10:05  zhh  阅读(311)  评论(0编辑  收藏  举报