D
Dave Wellsted
Guest
Im writing a console application using VB, Visual Studio Express 2012 for Desktop (version 2012.3), and the .NET framework version 4.5.
The framework allows me to set console colors from the original 16 CGA colors only. See the code snippet below:
Sub SetMyFavoriteColors()
Console.BackgroundColor = ConsoleColor.DarkBlue
Console.ForegroundColor = ConsoleColor.Yellow
End Sub
Ive looked into using a Win32 API call to try to get the full range of colors (RGB 32-bit) but the Win32 Console API doesnt offer a helpful solution either. Or if it does, Im overlooking it. Ive considered trying to get a Window handle (HWINDOW) from which I could obtain a Device Context handle (HDC) and then use the GDI APIs SetPalette() function to accomplish this, by Im hoping theres an easier solution. I hate to drop into C code and call the old GDI to do this --- if even that would accomplish my goal.
Once I start my console application, I can dynamically alter its properties using the Windows UIs properties dialog and this lets me set individual Red, Green, and Blue components each in the range (0-255) which makes for some really cool colors.
So how do I get this capability at run time and modify the colors programmatically? I sure would like some help on this one, guys! Im stumped... and frustrated... and have spent way too many hours trying to find an elegant solution.
Continue reading...
The framework allows me to set console colors from the original 16 CGA colors only. See the code snippet below:
Sub SetMyFavoriteColors()
Console.BackgroundColor = ConsoleColor.DarkBlue
Console.ForegroundColor = ConsoleColor.Yellow
End Sub
Ive looked into using a Win32 API call to try to get the full range of colors (RGB 32-bit) but the Win32 Console API doesnt offer a helpful solution either. Or if it does, Im overlooking it. Ive considered trying to get a Window handle (HWINDOW) from which I could obtain a Device Context handle (HDC) and then use the GDI APIs SetPalette() function to accomplish this, by Im hoping theres an easier solution. I hate to drop into C code and call the old GDI to do this --- if even that would accomplish my goal.
Once I start my console application, I can dynamically alter its properties using the Windows UIs properties dialog and this lets me set individual Red, Green, and Blue components each in the range (0-255) which makes for some really cool colors.
So how do I get this capability at run time and modify the colors programmatically? I sure would like some help on this one, guys! Im stumped... and frustrated... and have spent way too many hours trying to find an elegant solution.
Continue reading...