我怎样才能得到一个16进制的颜色code一个Color或者说,哈希code(例如#FFDFD991 )?
How can I get a Color from a Hexadecimal color code or say, Hash code (e.g. #FFDFD991)?
我读一个文件,并得到16进制的颜色code,我需要为十六进制的颜色$ C创建相应的 System.Windows.Media.Color 实例$ C。是否有任何框架内置的方法来做到这一点?
I am reading a file and getting Hexadecimal color code, I need to create the corresponding System.Windows.Media.Color instance for the Hexadecimal color code. Is there any inbuilt method in framework to do this?
推荐答案我假定这是一个ARGB code ...你指的的System.Drawing.Color 或 System.Windows.Media.Color ?后者在WPF用于示例。我还没有看到任何人提到它,所以以防万一你要找的是:
I'm assuming that's an ARGB code... Are you referring to System.Drawing.Color or System.Windows.Media.Color? The latter is used in WPF for example. I haven't seen anyone mention it yet, so just in case you were looking for it:
using System.Windows.Media; Color color = (Color)ColorConverter.ConvertFromString("#FFDFD991");更多推荐
如何使用.NET从十六进制颜色code得到的颜色?
发布评论