Jump to content

C sharp Programming - Adding Colour ?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
jeena1

jeena1

    Newbie

  • Members
  • PipPip
  • 13 posts
Hello,

How do I change the colour of text in a C Sharp Program?
for example, Console.WriteLine("Hello");
How do I get Hello to be viewed in Red?
?

_____________________

Polo Shirt Printing
T shirt Embroidery

Edited by jeena1, 09 March 2009 - 02:18 AM.


#2
njr1489

njr1489

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
Console.ForegroundColor = ConsoleColor.Red;

The same can be done with the background, just change it to Console.BackgroundColor.

#3
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Don't forget to change it back afterwards.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#4
ArekBulski

ArekBulski

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,376 posts
They are all right. But let me point something out here ok?

In WinForms projects you mostly use System.Drawing.Color class. As far as I can tell, only in Console projects there is a use for System.ConsoleColor class. And since people mostly prefer WinForms projects... I wanted to mention it.

Regards, :cool:
Arek Bulski.