c#-WPF string,color,brush之间的转换
2021-07-10 14:06
标签:views 转换 lin .net ref log rgb net ffffff
String转换成Color string-"ffffff"
Color转换成Brush
Brush转换成Color
c#-WPF string,color,brush之间的转换 标签:views 转换 lin .net ref log rgb net ffffff 原文地址:https://www.cnblogs.com/lonelyxmas/p/9678755.htmlColor color = (Color)ColorConverter.ConvertFromString(string);
String转换成Brush
BrushConverter brushConverter = new BrushConverter();
Brush brush = (Brush)brushConverter.ConvertFromString(string);
Brush brush = new SolidColorBrush(color));
//先将Brush转成string,再转成Color
Color color= (Color)ColorConverter.ConvertFromString(brush.ToString());
//将Brush转成SolidColorBrush,再取Color
Color color= ((SolidColorBrush)CadColor.Background).Color;
(ARGB)转换为Brush
Brush br = new SolidColorBrush(Color.FromArgb(cl.Color.A, cl.Color.R, cl.Color.G, cl.Color.B));
文章标题:c#-WPF string,color,brush之间的转换
文章链接:http://soscw.com/essay/103257.html