Results 1 to 4 of 4

Thread: Coloured RTF

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    23

    Post

    I have a rich text box with three colours, red, green and yellow. How can I extract only the red text from this RTF.....

    Thank you.
    Any help will be great

  2. #2
    Member
    Join Date
    Feb 1999
    Location
    NY
    Posts
    45

    Post

    Here's an algorithm:

    Function GetRedString(rtf as RichTextBox) As String

    dim i as long,ret as string
    rtf.sellength = 1

    for i = 1 to len(rtf.text)
    rtf.selstart = i
    if rtf.selcolor = vbRed then ret = ret & rtf.seltext
    next i
    GetRedString = ret
    End Function

    I just wrote that off the top of my head, so im not 100% sure it works, give it a whirl. Basically it checks the RGB value of each character in the textbox against the selected color, if they match it adds the character to a string, and returns it.


    ------------------
    -Mystiq

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    23

    Post

    Thank you mystiq.

    In the algorithm you provided, the rtf.selcolor only returns the color of the last character in the RTF.

    Are there any more methods extracting the red text??

    Thankful

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    23

    Post

    i would like to know how to communciate with a com port. when the input to the com port only have the transmit data pins and earth, no rts and cts. can i use comEvent to do it?

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