Results 1 to 6 of 6

Thread: alternative color for RichTextBox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    277

    alternative color for RichTextBox

    I want to make a chat program and I use RichTextBox to display the conversation

    how to display it in Colors .. for example my color is red,, and the other is blue

    Code:
    
    RichTextBox1.Text = RichTextBox1.Text & myText & vbCrLf
    RichTextBox1.Text = RichTextBox1.Text & comingText & vbCrLf

  2. #2
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    You need to find the start of the message, then the end, and then select the whole thing, and colour it.

    Don't Rate my posts.

  3. #3
    Lively Member
    Join Date
    Mar 2002
    Location
    Klamath Falls, OR
    Posts
    71
    You need to select the text, then color it.

    VB Code:
    1. dim OldMsgLen, NewMsgLen as integer
    2. OldMsgLen = len (rich.text)
    3. NewMsgLen = len (IncomingWinsockData)
    4. rich.text = rich.Text & IncomingWinsockData)
    5. rich.selstart = OldMsgLen
    6. rich.sellength = NewMsgLen
    7. rich.selcolor = vbRed


    Pretty much the same for your text as it is for theirs, I'm sure you can figure it out.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    277
    thanks for your help guys

    sorry I cannot figure it out

  5. #5
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    lol

    I'll see if I can dig up some code...
    Don't Rate my posts.

  6. #6
    Lively Member
    Join Date
    Mar 2002
    Location
    Klamath Falls, OR
    Posts
    71
    i'll look too, I wrote a chat program a while ago, maybe i can find it. It worked a bit differently though. It highlighted just the user names, kinda like AIM or MSN.

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