CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Location
    Melbourne
    Posts
    27

    Forecolor attribute individual character?

    Hi all (again!),

    Is it possible to change the forecolor of individual letters in a Rich Textbox? Suppose, for example, the user types "The cat in the hat". My program, interrogating the word before the space, detects "the" was typed. Looking up "the" in an array tells the program to change the "e" in "the" from black to blue, leaving "th" black.

    Can it be done?

    Thanks,

    Mark

  2. #2
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569
    yes.

    you can do it directly using RTF code, or indirectly by selecting the character (use selLength and selStart) then set the font colour of the text that has been selected.
    Mike

  3. #3
    Join Date
    Jan 2003
    Location
    7,107 Islands
    Posts
    2,487
    Yes,, just locate and set the appropriate value for SelStart and SelLength, and then set the desired color in SelColor property of the RichTextBox..
    Busy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured