Use Subscripts and Superscripts

You can use subscripts and superscripts in a RichTextBox control. To prevent the control from truncating text that is raised or lowered too far, reduce the characters’ size accordingly:

 Private Sub Form_Load()	RichTextBox1.Font.Name = "Times New Roman"	RichTextBox1.Font.Size = 10	RichTextBox1.Text = "H2SO4"' Move the numbers down 2 points.	MakeSubscript RichTextBox1, 1, 1, -2	MakeSubscript RichTextBox1, 4, 1, -2End SubPrivate Sub OffsetRichText(box As _	RichTextBox, start As Integer, _	length As Integer, offset As Integer)		box.SelStart = start		box.SelLength = length		box.SelFontSize = box.Font.Size + offset		box.SelCharOffset = -ScaleY(offset, _			vbPoints, vbTwips)		box.SelStart = 0		box.SelLength = 0End Sub
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: