c# 把 颜色值Hex 转换为 Color

2018-06-23 22:06:37来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

原文:

 http://abujj.me/archives/695

 

Assuming you mean the HTML type RGB codes (called Hex codes, such as #FFCC66), use theColorTranslator class:

 

System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#FFCC66");

 

If, however you are using an ARGB hex code, you can use the ColorConverter class from the System.Windows.Media namespace:
Color col = ColorConverter.ConvertFromString("#FFDFD991") as Color;

 



引用地址:
http://stackoverflow.com/questions/2109756/how-to-get-color-from-hexadecimal-color-code-using-net

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Cheatsheet: 2013 11.12 ~ 11.30

下一篇:How can I use Server.MapPath() from global.asax?