I want to write color text to the Visual Studio output window from c#. I want to output red code from my unit tests.
+2
A:
As far as I know, the output window in Visual Studio is a "simple textbox" type control that doesn't support colored text.
Scott Dorman
2010-03-11 16:17:29
A:
SetConsoleTextAttribute(hConsole, x)
Where k is an integer color value and hConsole is a standard output handle.
Ten Ton Gorilla
2010-03-11 16:17:38
That only affects a Console window (i.e., a DOS command prompt), not the Visual Studio output window.
Scott Dorman
2010-03-11 16:19:37
Yeah, misread the question, ... doh
Ten Ton Gorilla
2010-03-11 16:20:26
+1
A:
Far as I know, you can't do that. You can change the Console's font colour, but it has no effect on Visual Studio's output window.
The only way to change the text colour there is through Tools->Options->Fonts and Colors, and that affects all the text that is sent to the window.
Anna Lear
2010-03-11 16:19:54