Share via


Visual Basic: RichTextBox Control

SelCharOffset Property Example

This example uses a scroll bar to move selected text above or below the baseline. The minimum and maximum amount of offset is established by the font size of the text within the RichTextBox control. To try this example, put a RichTextBox control and a VScrollBar control on a form. Paste this code into the Change event of the VScrollBar control. Then run the example.

  Private Sub VScroll1_Change ()
   VScroll1.Max = RichTextBox1.SelFontSize
   VScroll1.Min = -(VScroll1.Max)
   RichTextBox1.SelCharOffset = VScroll1.Value
End Sub