c# 把 颜色值Hex 转换为 Color

原文:

 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

 

你可能感兴趣的:(color)