Thread: Changing Font colour for C++

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    9

    Changing Font colour for C++

    Hey, Hopefully someone can help me, I'm a beginer to C++, I know aperence isnt required in dos based programs but I need it to suit my purpose. I use both Visual Studio .Net 2003 and Borlad C++

    Would be grateful for a reply, if you need the code I can supply it but I dont feel it is nessicary.

    Thanks Again

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Controlling colour in the Windows console seems extremely limited. That is to say, I have no idea how cygwin does it.
    The most basic version uses SetConsoleTextAttribute, but this is not a powerful function, supporting only a few colours for foreground and background.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    2
    Read the FAQ.

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    25
    If you go into the folder for boland c++, you can find a graffics demo there.. you can try to study it some and see if you figure it out. they change size, front, colors etc etc. as for the colour you asked for u can use:

    Code:
    textbackground(color);  //Works after a clrscr();
    textattr(color > color);   //Works for cprintf(""); and sets the color of
     that line, or command. 
    textcolor(color);             //Works allso for cout. but you then set the
     color for the rest of the program, and you need to clrscr(); after the
     color is set.
    there are more tho.. but you can find some in the FAQ.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with my font manager
    By hannibar in forum C Programming
    Replies: 1
    Last Post: 03-07-2006, 08:03 AM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  3. Changing Font (Word COM)
    By UnclePunker in forum Windows Programming
    Replies: 1
    Last Post: 03-22-2004, 11:30 AM
  4. Changing font in rich edit, without affecting undo buffer
    By jverkoey in forum Windows Programming
    Replies: 3
    Last Post: 01-17-2004, 08:54 PM
  5. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 07:18 AM