如何从C#中的十六进制代码中获取前景色?

时间:2013-10-24 13:42:27

标签: c# colors console-application

    using System;
    class ColorTheText
    {
        public static void Main(string [] args)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\t\tCongratulations! You have cleared this level. \n\n\t\t\t    Entering Level 2...");
            Console.ForegroundColor = ConsoleColor.White;
        }
    }

但我想从十六进制代码中获取颜色,即ConsoleColor。十六进制代码的颜色(#c0c0c0)。怎么做?

1 个答案:

答案 0 :(得分:0)

System.Drawing.ColorTranslator.FromHtml("#c0c0c0");

这样的东西是你需要的吗? 也许你服务。

抱歉我的英文。

相关问题