设置颜色:
Color color = Color.FromArgb(透明度, red数字, green数字, blue数字); //这四个数字范围都是(0-255)
Color color = Color.FromRgb(red数字, green数字, blue数字);//默认透明度为255;
button.BackGround=new SolidColorBrush(Colors.AliceBlue);
String转换成Color:
Color color = (Color)ColorConverter.ConvertFromString(string);
String转换成Brush:
Brush brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#555555"));
Color转换成Brush:
Brush brush = new SolidColorBrush(color));
Brush转换成Color有两种方法:
Color color= (Color)ColorConverter.ConvertFromString(brush.ToString());
Color color= ((SolidColorBrush)CadColor.Background).Color;