当前位置: 首页>>代码示例>>C#>>正文


C# ConsoleColor类代码示例

本文整理汇总了C#中ConsoleColor的典型用法代码示例。如果您正苦于以下问题:C# ConsoleColor类的具体用法?C# ConsoleColor怎么用?C# ConsoleColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConsoleColor类属于命名空间,在下文中一共展示了ConsoleColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintCharOnPos

        public static void PrintCharOnPos(char ch, int y, int x, ConsoleColor color)
        {
            Console.ForegroundColor = color;

            Console.SetCursorPosition(x, y);
            Console.Write(ch);
        }
开发者ID:nincheto16,项目名称:TankBattle,代码行数:7,代码来源:ConsoleAction.cs

示例2: Write

 private void Write(string s, ConsoleColor c)
 {
     ConsoleColor temp = Console.ForegroundColor;
     Console.ForegroundColor = c;
     Write(s);
     Console.ForegroundColor = temp;
 }
开发者ID:CeeJay79,项目名称:aion_ext,代码行数:7,代码来源:ObjectDumper.cs

示例3: Print

 static void Print(ConsoleColor color, string format, params object[] args)
 {
     var old = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(format, args);
     Console.ForegroundColor = old;
 }
开发者ID:kstreet,项目名称:btw-samples-homework,代码行数:7,代码来源:Program.cs

示例4: Initialize

 public static void Initialize(ConsoleColor defaultColor = ConsoleColor.Gray)
 {
     switches = new List<List<Switch>>();
     DefaultColor = defaultColor;
     _lock = new object();
     isInitialized = true;
 }
开发者ID:TwoFX,项目名称:firework-engine,代码行数:7,代码来源:UIManager.cs

示例5: WriteLine

 public static void WriteLine(ConsoleColor color, object value)
 {
     var previousColor = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(value);
     Console.ForegroundColor = previousColor;
 }
开发者ID:pvginkel,项目名称:Jint2,代码行数:7,代码来源:ConsoleEx.cs

示例6: CPrint

 public static void CPrint(string Text, ConsoleColor Color)
 {
     //Set The Colour Of The Font, Then Set It Back To White
     Console.ForegroundColor = Color;
     Console.Write(Text);
     Console.ForegroundColor = ConsoleColor.White;
 }
开发者ID:cheynewallace,项目名称:pinger,代码行数:7,代码来源:Program.cs

示例7: VerboseWriteLine

 public static void VerboseWriteLine(ConsoleColor color, string output)
 {
     if (WriteVerboseOutput)
     {
         WriteLine(color, output);
     }
 }
开发者ID:rgregg,项目名称:markdown-scanner,代码行数:7,代码来源:FancyConsole.cs

示例8: Log

 private static void Log(string message, ConsoleColor color)
 {
     var keepColor = Console.ForegroundColor;
       Console.ForegroundColor = color;
       Console.WriteLine(message);
       Console.ForegroundColor = keepColor;
 }
开发者ID:decarufe,项目名称:fluentpatterns,代码行数:7,代码来源:Logger.cs

示例9: Write

 public static void Write(ConsoleColor color, string content)
 {
     Console.ForegroundColor = color;
     BreakIntoLines(content)
         .Each(l=>Console.WriteLine(l));
     Console.ResetColor();
 }
开发者ID:nieve,项目名称:FubuRESTInnovation,代码行数:7,代码来源:ConsoleWriter.cs

示例10: WriteLine

 static void WriteLine(ConsoleColor color, string text, params object[] args)
 {
     var oldColor = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(text, args);
     Console.ForegroundColor = oldColor;
 }
开发者ID:frankies,项目名称:lokad-iddd-sample,代码行数:7,代码来源:LoggingWrapper.cs

示例11: ConsoleWriteLine

 private void ConsoleWriteLine(string text, ConsoleColor color)
 {
     ConsoleColor before = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(text);
     Console.ForegroundColor = before;
 }
开发者ID:bizx,项目名称:HubSpotSync,代码行数:7,代码来源:Program.cs

示例12: ProgressBar

 /// <summary>
 /// Creates progress bar.
 /// </summary>
 /// <param name="name">Name of the widget.</param>
 /// <param name="pos">Position of the progress bar.</param>
 /// <param name="width">Width of the progress bar</param>
 /// <param name="maxValue">Maximum value.</param>
 /// <param name="value">Current value (default: 0).</param>
 /// <param name="fc">Foreground color (default gray).</param>
 /// <param name="bc">Background color (default black).</param>
 public ProgressBar(string name, Position pos, int width, int maxValue, float value = 0.0f,
     ConsoleColor fc = ConsoleColor.Gray, ConsoleColor bc = ConsoleColor.Black)
     : base(name, pos, width, 1, false, fc, bc)
 {
     this.Value = value;
     this.MaxValue = maxValue;
 }
开发者ID:Tamschi,项目名称:FacePuncher,代码行数:17,代码来源:ProgressBar.cs

示例13: ColoredConsoleWrite

 public static void ColoredConsoleWrite(ConsoleColor color, string text)
 {
     ConsoleColor originalColor = System.Console.ForegroundColor;
     System.Console.ForegroundColor = color;
     System.Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}] " + text);
     System.Console.ForegroundColor = originalColor;
 }
开发者ID:Caddyrn,项目名称:PokemonGo-Bot,代码行数:7,代码来源:Logger.cs

示例14: WriteColor

 public static void WriteColor(ConsoleColor ForeGround, string var)
 {
     if (ForegroundColor != ForeGround)
         ForegroundColor = ForeGround;
     WriteLine(var.PadRight(var.Length % WindowWidth, ' '));
     LowerBoundOutput();
 }
开发者ID:ShaneK2,项目名称:inVtero.net,代码行数:7,代码来源:Support.cs

示例15: UseTextColour

 public static void UseTextColour(ConsoleColor colour, Action action)
 {
     var prevForegroundColor = Console.ForegroundColor;
     Console.ForegroundColor = colour;
     action();
     Console.ForegroundColor = prevForegroundColor;
 }
开发者ID:izrik,项目名称:IrcDotNet,代码行数:7,代码来源:ConsoleUtilities.cs


注:本文中的ConsoleColor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。