铸造颜色名称的SolidColorBrush [英] Cast Color Name to SolidColorBrush
本文介绍了铸造颜色名称的SolidColorBrush的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么能投 颜色名称到的SolidColorBrush
键入?我的意思是这个词,即黄色。
How I can cast color name to SolidColorBrush
type? I mean the word i.e. "Yellow".
SolidColorBrush scb = ??? ; // "Yellow"
感谢您!
推荐答案
有关获取颜色,使用:
Color col=(Color)ColorConverter.ConvertFromString("Red");
然后创建你的画笔:
Then create your brush:
Brush brush=new SolidColorBrush(col);
或者,如果你可以使用的颜色,枚举
or if you can use the Colors-enum
Brush brush=new SolidColorBrush(Colors.Red);
这篇关于铸造颜色名称的SolidColorBrush的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文