We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 99,329 times

Contents

Related Categories

Rich Text Box Controls - Colors, bullets & superscript

ZERO-COOL

Colors, bullets & superscript

First there's coloring.  You set this by changing the SelColor to the color of your choice.  You can use any color (vbcolor, RGB, QBColors).

Object.SelColor = color

RichTextBox1.SelColor = vbGreen
'Now anything typed will be green

Now protecting.  Protecting disabled editing from the selected text

Object.SelProtected

RichTextBox1.SelProtected = True

Any text that was selected during this method is now protected.

Bullets are creating by setting the SelBullet property to true.  This creates bullets where new lines are put, and the line the cursor was just at.

Object.SelBullets = True

'RichTextBox displays:
'We are know for:
'Creating programs
RichTextBox.SelBullets = True
'RichTexBox now displays
'We are know for:
'·Creating programs

With the bullets you can indent them using BulletIndent

Object.BulletIndent = Integer

'Using the one before
'RichTextBox1 displays:
'We are know for:
'·Creating programs
RichTextBox1.BulletIndent = 200
'RichTextBox1 no displays:
'We are know for:
'·       Creating programs

Next is how to superscript or subscript. To make superscript or subscript you have to use the SelCharOffSet and SelFontSize at the same time.  The SelCharOffSet just changes the position of the text.  

Using the SelCharOffSet property:

Object.SelCharOffSet property

   To subscript, you just need to change the SelFontSize.  If you want to superscript, you must change the font size and the SelCharOffSet.
Hello
SubScript:

Dim VariableName As Integer
Integer = Object.SelFontSize
Object.SelFontSize = Integer / 3 * 2
'This makes the size 2/3 of the original

SuperScript:

Dim VariableName As Integer
Object.SelFontSize = Integer / 3 * 2
Object.SelCharOffSet = Temp * 5

That is how you can make a subscript or superscript font.  They covers most of the control on the rich textbox.

I'm a 12 year old child who is interested in learning programming languages. My current two are Visual Basic and C++.

Comments

  • hi

    Posted by kailas on 17 Oct 2005

    hi redstar...

    m also facing same problem.. do u got any solution?

    with regards,

    kailas

  • arrow intendation

    Posted by sshamsudheen on 21 Apr 2005

    how to get arrow intendation

  • bullet intending

    Posted by sshamsudheen on 21 Apr 2005

    how to chane the bullet intend as arrow

  • Saving and Loading Text formats

    Posted by DanTheMan on 03 Feb 2005

    I am wondering if thier is a way to save and load text formatting using VB6, for example fonts, text colors etc. Does anybody know any easy ways round it???

  • a work around

    Posted by ulaska on 26 Aug 2003

    Try the following code as work around:

    ' flag the section with bullet mark
    rtfSectionText.SelBullet = True

    ' replace bullet with numbers
    rtfSectionText.SelRTF = Replace(rtfSectionText.SelRTF, ...