c#.net代码,用于在Windows Phone 8中从hexaclor代码转换为SolidbrushColor(“Red”)。 [英] c#.net code for convert from hexaclor code to SolidbrushColor ("Red")in windows phone 8.
本文介绍了c#.net代码,用于在Windows Phone 8中从hexaclor代码转换为SolidbrushColor(“Red”)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的先生/女士,
c#.net代码,用于在Windows Phone 8中将六声道代码转换为SolidbrushColor("红色")。
谢谢&问候,
SrinivaaS。
解决方案
你可以用这种方式
公共静态类ColorHelper
{
public static SolidColorBrush GetColorFromHexa(string hexaColor)
{
返回新的SolidColorBrush(
Color.FromArgb(255,
Convert.ToByte(hexaColor.Substring(1,2),16),
Convert.ToByte(hexaColor.Substring(3) ,2),16),
Convert.ToByte(hexaColor.Substring(5,2),16)
)
);}
}或
( SolidColorBrush )( new BrushConverter ( )。 ConvertFrom (
" #ffaacc" ));
Dear Sir/Madam,
c#.net code for convert from hexaclor code to SolidbrushColor("Red") in windows phone 8.
Thanks & Regards,
SrinivaaS.
解决方案
Hi,
You can in this way
public static class ColorHelper { public static SolidColorBrush GetColorFromHexa(string hexaColor) { return new SolidColorBrush( Color.FromArgb(255, Convert.ToByte(hexaColor.Substring(1, 2),16), Convert.ToByte(hexaColor.Substring(3, 2),16), Convert.ToByte(hexaColor.Substring(5, 2), 16) ) );} }Or
(SolidColorBrush)(new BrushConverter().ConvertFrom("#ffaacc"));
这篇关于c#.net代码,用于在Windows Phone 8中从hexaclor代码转换为SolidbrushColor(“Red”)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文