前回はConsoleの背景色を設定する方法を紹介しました。
今回は、前景色を設定する方法を紹介します。
このTipsは.NET Framewor2.0以降で動作します。
背景色変えるにはConsoleクラスのForegroundColorプロパティを設定します。
Consoleの前景色を設定する
Sub Main()
Console.ForegroundColor = ConsoleColor.Black
Console.WriteLine("ForegroundColor color is Black")
Console.ForegroundColor = ConsoleColor.DarkBlue
Console.WriteLine("ForegroundColor color is DarkBlue")
Console.ForegroundColor = ConsoleColor.DarkGreen
Console.WriteLine("ForegroundColor color is DarkGreen")
Console.ForegroundColor = ConsoleColor.DarkYellow
Console.WriteLine("ForegroundColor color is DarkYellow")
Console.ForegroundColor = ConsoleColor.DarkCyan
Console.WriteLine("ForegroundColor color is DarkCyan")
Console.ForegroundColor = ConsoleColor.DarkRed
Console.WriteLine("ForegroundColor color is DarkRed")
Console.ReadLine()
End Sub