by archetech (1 Submission)
Category: Custom Controls/Forms/Menus
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (6 Votes)
Sick of those ugly VB 6 scroll bars that don't support XP themes? Don't feel like messing with a manifest? Here is the code for you. This scrollbar control acts just like the XP scroll bar on a multi-line text box because it is. The control just uses an API call and a timer to expose the scroll event of the textbox and then hides the textbox. This means you get allot of functionality with very little code. There is room for improvement and additions, but I wanted to keep the code as simple as I could.
Side Effects
Leave a little width on the control instance in the designer so you can drag and resize it. The designer does not seem to detect click events on the textbox scrollbar.
API DeclarationsPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long