HIRO's.NET

VB.NET, C#, PowerShell Tipsサイト

 VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。

 基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。

HIRO's.NET RSSHIRO's.NET RSS


C# 2005の開発でお困りのことはありませんか?
そんな悩みは当サイトで解決!!

HOME > C# 2005 Tips > その他 Tips メニュー> Console Tips メニュー

04.コンソールの前景色を設定する

UPDATE:2006/09/10 

<< 前のTips  次のTips >>

 


 コンソールの背景色を設定するには、ForegroundColorプロパティを使用します。

 
サンプル
static void Main(string[] args)
{
    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();
}