• Welcome to Valhalla Legends Archive.
 

Help with RichTextBox

Started by DarkSoldier, August 20, 2004, 03:19 PM

Previous topic - Next topic

DarkSoldier

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?

BaDDBLooD



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, "!"

There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

DarkSoldier

uh fast reply, thanks a lot!
im going to test that now...

BaDDBLooD

Quote from: DarkSoldier on August 20, 2004, 03:35 PM
uh fast reply, thanks a lot!
im going to test that now...

Well?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Networks

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.

DarkSoldier

ok, tested it and modified it a little bit, works fine!

R.a.B.B.i.T

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....

Networks

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 :)

MyndFyre

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.  :)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.