Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Jul 24, 1998



Application Security Testing: An Integral Part of DevOps

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, -2
End Sub

Private 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 = 0
End Sub
Rod Stephens
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date