Control the Appearance of Console Application


Introduction 

This article will teach you about how you can control the appearance of the console application like background color of the console screen, forecolor of screen, size of the screen title of the screen.

Technology

CSharp .net 2.0/3.5 

Implementation 

You can control the appearance of the console screen using the System.Console Class's static properties...

1.gif

namespace ConsoleAppearance

{

    class Program

    {

        static void Main(string[] args)

        {

            //Changing the Title of Console

 

            Console.Title = "Test Console ..";

 

            //Changing The Foregroud of Console"

 

            Console.ForegroundColor = ConsoleColor.Cyan;

            Console.WriteLine("Console foregound color ");

 

            //Setting Window Size

            Console.SetWindowSize(100, 50);

 

            //Changing the Back gound color

 

            Console.BackgroundColor = ConsoleColor.DarkGray;

            Console.ForegroundColor = ConsoleColor.DarkRed;

 

            Console.WriteLine("Testing back +fore color ");

            Console.ReadKey();

        }

    }

}


Conclusion


We have just seen in the article about how to control the appearance of the Console Window.


Similar Articles