从颜色转换成刷 [英] convert from Color to brush
本文介绍了从颜色转换成刷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何转换颜色
来一个用C 刷
#?
< DIV CLASS =h2_lin>解决方案
这是颜色
到刷
.. ..
您不能转换它,你必须做出一个新的刷....
的SolidColorBrush刷=新的SolidColorBrush(myColor);
现在,如果你需要它在XAML中,你可以做一个自定义值转换器和使用,在结合
How do I convert a Color
to a Brush
in C#?
解决方案
This is for Color
to Brush
....
you can't convert it, you have to make a new brush....
SolidColorBrush brush = new SolidColorBrush( myColor );
now, if you need it in XAML, you COULD make a custom value converter and use that in a binding
这篇关于从颜色转换成刷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文