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

前端 未结 16 797
不思量自难忘°
不思量自难忘° 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:17

    WPF:

    using System.Windows.Media;
    
    //hex to color
    Color color = (Color)ColorConverter.ConvertFromString("#7AFF7A7A");
    
    //color to hex
    string hexcolor = color.ToString();
    

提交回复
热议问题