How do I get the color from a hexadecimal color code using .NET?

前端 未结 16 982
不思量自难忘°
不思量自难忘° 2020-11-22 06:45

How can I get a color from a hexadecimal color code (e.g. #FFDFD991)?

I am reading a file and am getting a hexadecimal color code. I need to create the

16条回答
  •  无人共我
    2020-11-22 07:02

    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");
    

提交回复
热议问题