C#中Brush、Color、String相互转换
来源:互联网 发布:娱乐圈生活 知乎 编辑:程序博客网 时间:2024/05/16 05:34
示例:
using System.Windows.Media;
1、String转换成Color
Color color = (Color)ColorConverter.ConvertFromString(string);
2、String转换成Brush
BrushConverter brushConverter = new BrushConverter();Brush brush = (Brush)brushConverter.ConvertFromString(string);
3、Color转换成Brush
Brush brush = new SolidColorBrush(color));
Brush brush = new SolidColorBrush(Colors.Red));//博主添加,非转载
4、Brush转换成Color有两种方法:
(1)先将Brush转成string,再转成Color。
Color color= (Color)ColorConverter.ConvertFromString(brush.ToString());(2)将Brush转成SolidColorBrush,再取Color。
Color color= ((SolidColorBrush)CadColor.Background).Color;
转载自:http://blog.csdn.net/wmjcom/article/details/4347672
- C#中Brush、Color、String相互转换
- C#中Brush、Color、String相互转换
- WPF color、brush、string转换
- WPF color、brush、string转换
- wpf中color、brush、string之间的转换
- wpf中string、color、brush之间的转换
- WPF 中Color类型转换成Brush
- string和color相互转换
- c#中System.Drawing.Color 和System.Drawing.Brush 类型转换
- c#-WPF string,color,brush之间的转换
- c#中Enum和String相互转换
- C# string ASCII相互转换
- c#中 uint--byte[]--char[]--string相互转换汇总
- c#中 uint--byte[]--char[]--string相互转换汇总
- 【C#】c#中 uint--byte[]--char[]--string相互转换汇总
- C#中int类型与string类型相互转换
- c#中 uint--byte[]--char[]--string相互转换汇总
- c#中 uint--byte[]--char[]--string相互转换汇总
- 不同session的history操作同步问题
- 获取前台jsp页面上传图片的尺寸
- 【Linux】CentOS6U4升级kernel命令
- 如何求一个成员在结构体中的偏移
- ARM处理器运行模式
- C#中Brush、Color、String相互转换
- C# POP3、IMAP、SMTP收发邮件
- 11.21C语言----数组指针练习
- 键盘键值
- 数据结构与算法分析学习笔记之一-链表
- 构造函数为什么不能是虚函数
- 一张图看懂财务报表分析
- 设计递归函数,求出并输出Fibnacci序列的第20个数,Fibnacci序列形如0,1,1,2,3,5,8...
- eclipse failed to create the java virtual machine 问题图文解析