从颜色转换成刷 [英] convert from Color to brush

查看:171
本文介绍了从颜色转换成刷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何转换颜色来一个用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆