HIRO's.NET Blog

PowerShellが好き

目次

Blog 利用状況

ニュース

あわせて読みたい

書庫

日記カテゴリ

リンク

Consoleの前景色を設定する

前回は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

投稿日時 : 2007年4月12日 23:00

コメントを追加

No comments posted yet.
タイトル
名前
URL
コメント