Thread: GUI Text Color Problem

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    13

    GUI Text Color Problem

    Hi everyone. I've ran into a little, well, a huge problem. I'm working on a syntax coloring text editor... My only problem is actually doing the coloring. In a basic edit control, I can't have more than one font color in the control at once. So, for example, if I set the text color to blue because I want one word to be blue, all the text becomes blue. This is kindof the most important part of the program.... yet I can't find any articles from google, any tutorials, or any guidance on the best direction of approaching this problem.. Does anyone know of a good article that would help me, or very good tutorial, or does anyone just plain know how to do this?

    Do I need to implement some other control? Am I going about this the wrong way? Any help would be greatly appreciated. Thanks in advance.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    I'm guessing you're writing for Windows because of mentioning "a basic edit control".

    Check MSDN for a Rich Edit Control or whatever it's actually named.

  3. #3
    Registered User
    Join Date
    Jun 2007
    Posts
    13
    Oops, sorry I forgot to mention that. Yes, I am using a Windows.

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    You would have to use a Rich Edit Control, or make a custom callback for your control and just paint your own text using TextOut() when it gets a WM_PAINT message. (Also, use SetTextColor() to change text color.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectX | Drawing text
    By gavra in forum Game Programming
    Replies: 4
    Last Post: 06-08-2009, 12:23 AM
  2. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Replies: 1
    Last Post: 07-13-2002, 05:45 PM
  5. GUI Programming :: C++ Exclusive
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2002, 03:22 PM