
Introduction
How can i use colors to make my console application look pretty with VB.NET ? I was writing a remoting server when this idea came ... So i've made this little module ! It was not really difficult to do but i think it could save your time ;)
How to use it ?
You can either change background and foregroud ...
ConsoleTools.SetConsoleColors(ConsoleColor.Green, ConsoleColor.DarkBlue)
... or just foreground :
ConsoleTools.SetConsoleColors(ConsoleColor.Pink)
How does it run ?
I just use kernel api's SetConsoleTextAttribute (to change colors) and GetStHandle (to retrieve console output handles). An enumeration has been created to have bases colors codes : enumeration values must be directly used to change foreground color, and enumeration values * 16 (mask) must be used to change foreground color.
So you just have now to use SetConsoleColors function (which use kernel's api) to change your console colors ...
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here