如何十六进制#FFFFFF转换的System.Drawing.Color [英] How to convert Hexadecimal #FFFFFF to System.Drawing.Color

查看:165
本文介绍了如何十六进制#FFFFFF转换的System.Drawing.Color的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  

可能重复:结果
  如何从十六进制颜色$ C取色$ c。使用.NET?


我要像 #FFFFFF 字符串转换为的System.Drawing.Color 。你是怎么做到的?


解决方案

 字符串十六进制=#FFFFFF;
色_Color = System.Drawing.ColorTranslator.FromHtml(十六进制);

请注意:哈希是很重要的。

Possible Duplicate:
How to get Color from Hex color code using .NET?

I want to convert a string like #FFFFFF to System.Drawing.Color. How do you do that?

解决方案

string hex = "#FFFFFF";
Color _color = System.Drawing.ColorTranslator.FromHtml(hex);

Note: the hash is important!

这篇关于如何十六进制#FFFFFF转换的System.Drawing.Color的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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