views:

213

answers:

3

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
A: 
SetConsoleTextAttribute(hConsole, x)

Where k is an integer color value and hConsole is a standard output handle.

More Here - easier commands

Ten Ton Gorilla
That only affects a Console window (i.e., a DOS command prompt), not the Visual Studio output window.
Scott Dorman
Yeah, misread the question, ... doh
Ten Ton Gorilla
+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