Results 1 to 4 of 4

Thread: Coloring specific words in a textbox?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    19

    Question

    I need an extremely fast way to color specific words a color such as vbBlue or RGB(12,90,0) or something. The thing is it has to be able to process multiple thousand words in just a few seconds.

  2. #2
    Guest
    A regular textbox does not support that. You have to use a RichTextBox, and here is a thread which shows you how to highlight certain words.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    19
    Already tried that; its extremely slow for something that has to color 50k words

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    If you study the RTFtext property of a richtextbox you'll get soon what tags you need to activate and deactivate blue text, next you need to do is operate the RTFtext in a buffer string instead (and the richtextbox won't update all the time causing slowness) - Use instr and Mid to search and insert the tags, it's not the fastest way either but i'm sure it's lot more faster than on that thread. Fastest way would be to convert into a byte array and use copymemory
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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