Results 1 to 6 of 6

Thread: Adding mutiple colours and fonts...

  1. #1

    Thread Starter
    Registered User
    Join Date
    Aug 2000
    Posts
    19
    -----
    Last edited by pir8eer; Oct 8th, 2005 at 08:24 AM.

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    You have to use a RichTextBox.

    In code, use the RichTextBox's SelStart, SelLength, SelFont, etc. properties to change the color/fonts of ranges of text:

    ' make first 10 characters bold
    RTF.SelStart = 0
    RTF.SelLength = 10
    RTF.SelBold = True
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  3. #3
    Guest
    You could also use the microsoft internet control.
    This would let people send each other embeded pictures and hyperlinks as well.

    Just parse the data people send to make sure it is valid.
    If someone sends you just a <b> then all your text in your chat window will go bold!!


    I have used this and it words very well.

    J.

  4. #4
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    Hey Guys
    I need some info on the same subject "RTB 's" .
    Can I append text to the box and keep the formating ,like the color and font style or Do I have to read the whole RTF and reformat it ever time I add to it ?

    Thankx
    Private1
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

  5. #5
    Guest
    You can either select text and then apply the format or you can directly modify the RTF code itself (this can end up getting very hardcore)

  6. #6
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    I'm downloading a bunch of samples right now on RTB's .
    What are your thoughts on this . I made a chat client and I want to impliment colores and fonts . Did this before .

    Code:
    Public Sub colorize()
        Dim posEnd, posStart, x, i As Integer
        
        x = 0
        i = 0
    
        For i = 0 To Len(RichTextBox1.Text)
            RichTextBox1.SelStart = i
            RichTextBox1.SelLength = 1
    
            If RichTextBox1.SelText = ">" Then  'start tag
                posStart = i
                RichTextBox1.SelColor = vbRed
            
            End If
    
        Next i
    
    End Sub
    as you can imagine by the time there was a bunch written in the box that it flashed and scrolled alot . Where does one find the RTF codes to modify them ?

    Thnks again ,
    Private
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

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