Products Technologies Demo Docs Blog Support Company

Replacing the TX Text Control Scrollbars

Replace the default TX Text Control scrollbars with custom graphical arrow buttons using the ScrollPosY property. This Visual Basic code sample manages the vertical scroll position with a configurable twip increment and synchronizes the internal position through the VScroll event.

Replacing the TX Text Control Scrollbars

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

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

Windows FormsWPF.NET

Create a Table of Contents in Windows Forms using C#

This article explains how to create a table of contents in Windows Forms using the ribbon or programmatically. Creating a table of contents is required to organize large documents.


Windows FormsList.NET

Two Ways to Restart Numbered Lists in TX Text Control

In TX Text Control, numbered lists are continued by default and need to be reset when required. There is more than one way if you want to restart numbered lists in a document. In this article, two…


.NETSample

Paste Special: The Easy Way to Implement

TX Text Control version 15.0 introduced a ClipboardFormat parameter on the Paste method, enabling native Paste Special functionality. The GetClipboardFormats method returns all available clipboard…


.NETSampleSections

How to Remove All Section Breaks in a Document?

TX Text Control 15.0 adds per-section page column support alongside existing section breaks. To remove all section breaks programmatically, iterate through SectionCollection using…


.NETPrintingSample

Batch Printing: How to Print Documents in One Print Job

Batch printing multiple documents as a single print job using TX Text Control relies on a .NET PrintDocument with PrintPage and QueryPageSettings events. Each page is rendered individually via the…

Share on this blog post on: