Thread: Automatic Rich Text Edit

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Question Automatic Rich Text Edit

    I want to create a richtext edit. But with things like my numbers to be blue and the text red. I want this to be those colors by them selfs even when the user changes text, Much like IDEs or Notepad++. How would I do this? Thanks, Queatrix.

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Kind of like syntax highlighting? That sounds like a good buzzword.

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> Kind of like syntax highlighting

    yeah, that's exactly what I mean.

  4. #4
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    310
    Quick reference:

    1. First, find the word, use EM_FINDTEXT.
    2. EM_FIND_TEXT uses FINDTEXT, which uses CHARRANGE, start and ending position of the word.
    3. Then, use EM_SETCHARFORMAT, which uses CHARFORMAT, for start and end position, color, masks, etc.

    Good luck!
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. rich edit 4.1 is giving me a head-ache
    By master5001 in forum Windows Programming
    Replies: 3
    Last Post: 07-01-2005, 01:21 PM
  2. edit box affecting displaying of text?
    By algi in forum Windows Programming
    Replies: 4
    Last Post: 05-04-2005, 03:28 PM
  3. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM