Sometimes you have to replace the internal scrollbars with customized ones. Especially, if you need to adapt TX Text Control to the special look and feel of the current application.
Consider two graphical arrow buttons to scroll up and down. The following code shows how to realize such scrollbars. We can use the ScrollPosY property to specify a new scroll position.
The global variable x represents the current scroll position and the variable d is the amount of twips to scroll at once.
Public x as Long Public d as Integer Private Sub Command2_Click() Dim curTextExt() As Long curTextExt = TXTextControl1.GetTextExtent If x < curTextExt(1) Then x = x + d TXTextControl1.ScrollPosY = x End If End Sub Private Sub Command3_Click() If x > 0 Then x = x - d TXTextControl1.ScrollPosY = x End If End Sub Private Sub Form_Load() x = 0 d = 500 End Sub Private Sub TXTextControl1_VScroll() x = TXTextControl1.ScrollPosY End Sub