Console Support In Whidbey
Whidbey is adding support for the full range of Console features provided by Win32, such as manipulating the full console window, applying colors, and reading directly from keyboard.
For coloring, developers can now set Console.Background and Console.Foreground color to any one of 16 standard colors. The title of the console window can be changed via Title. Clearing the console window is now as easy as calling Clear. The console window and buffer can be manipulated by calling SetBufferSize and MoveBufferArea. Keyboard input is accessed via the KeyAvailable, ReadKey, TreatControlCAsInput members and the CancelKeyPress event. Cursor position can also be changed via Cursor.Left and Cursor.Top. Console.Beep provides basic console sound support. These are just a sampling of the new Console API.
When I learned about this new Console support last year, I decided that I could not wait for Whidbey and implemented my own WinConsole class, after which I published an article "Console Enhancements" and the accompanying source code in CodeProject last July. This was just one day's work.
My WinConsole class includes most of the features provided in Whidbey's console class plus a few additional capabilities. This class also provides the ability to use a console in a WinForms application. This new capability doesn't require a WinForms application be compiled as a console application and can dynamically show and hide the console window.