Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: DarkSoldier on August 20, 2004, 03:19 PM

Title: Help with RichTextBox
Post by: DarkSoldier on August 20, 2004, 03:19 PM
Ok i just started trying to make a little bot... i used the richtx32.ocx to get a box where i can use different colors, but i cant find any site where its really good explained how to use colors. Everytime if i maybe found a way to use colors i get errors...
an example:

Writing the line then searching for it, selecting it and changing its color....
or
Setting a color, then writing the line...
nothing works for me, or i just use this code wrong,,,
can some1 give me a real easy example of a working color code?
Title: Re:Help with RichTextBox
Post by: BaDDBLooD on August 20, 2004, 03:30 PM


Public Function AddChat(ByVal RTB as RichTextBox, ParamArray Blub() As Variant)
   Dim i As Integer
       With RTB
           .SelStart = 99999999
           .SelLength = 0
           .SelColor = vbWhite
           .SelText = "[" & Time & "] "
           .SelStart = 99999999
       End With
   For i = LBound(Blub) To UBound(Blub) Step 2
       With RTB
           .SelStart = 99999999
           .SelLength = 0
           .SelColor = Blub(i)
           .SelText = Blub(i + 1) & Left$(vbCrLf, -2 * CLng((i + 1) = UBound(Blub)))
           .SelStart = 99999999
       End With
   Next i
End Function



Sample Usage:



AddChat frmMain.rtbChat, vbYellow, "Welcome!"



More than one color?



AddChat frmMain.rtbChat, vbYellow, "w", vbGreen, "e", vbYellow, "l", vbGreen, "c", vbYellow, "o", vbGreen, "m", vbYellow, "e", vbBlue, "!"

Title: Re:Help with RichTextBox
Post by: DarkSoldier on August 20, 2004, 03:35 PM
uh fast reply, thanks a lot!
im going to test that now...
Title: Re:Help with RichTextBox
Post by: BaDDBLooD on August 20, 2004, 05:25 PM
Quote from: DarkSoldier on August 20, 2004, 03:35 PM
uh fast reply, thanks a lot!
im going to test that now...

Well?
Title: Re:Help with RichTextBox
Post by: Networks on August 20, 2004, 05:27 PM
Can anyone provide a RichText Box tutorial really quick? Just things like making part of a line bold and the next not or maybe even the whole line. Something simple to understand and use, so I can italize as well.
Title: Re:Help with RichTextBox
Post by: DarkSoldier on August 24, 2004, 05:03 PM
ok, tested it and modified it a little bit, works fine!
Title: Re:Help with RichTextBox
Post by: R.a.B.B.i.T on August 24, 2004, 05:25 PM
Quote from: Networks on August 20, 2004, 05:27 PM
Can anyone provide a RichText Box tutorial really quick? Just things like making part of a line bold and the next not or maybe even the whole line. Something simple to understand and use, so I can italize as well.
.SelBold = True
.SelItalic = True

It's not that hard....
Title: Re:Help with RichTextBox
Post by: Networks on August 25, 2004, 05:59 PM
Quote from: R.a.B.B.i.T on August 24, 2004, 05:25 PM
Quote from: Networks on August 20, 2004, 05:27 PM
Can anyone provide a RichText Box tutorial really quick? Just things like making part of a line bold and the next not or maybe even the whole line. Something simple to understand and use, so I can italize as well.
.SelBold = True
.SelItalic = True

It's not that hard....

Wow.. it really isn't. Anyway thanks :)
Title: Re:Help with RichTextBox
Post by: MyndFyre on August 25, 2004, 06:27 PM
You can do what I've done and create a rich text generator.  It's not that bad once you've figured out the general syntax and formatting rules.  :)