VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Smooth Scrolling DataGrid

Darryn Frost  (7 Submissions)   Custom Controls/Forms/Menus   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

This code allows you to have the smooth-scrolling effect seen in better applications on your datagrids(could also apply to other scroll bars in VB)
When you grab the trackbar and move it, VB doesn't do anything until you let go. Or if you click on the trackbar itself, the grid just jumps.
This code shows you how to change these effects so that the grid(or text) will scroll smoothly as you drag or click.

Assumes
I used the "MsgBlaster" .Bas module and type library for the subclassing, they are available free on the net, and I will upload it in a seperate Listing here right after this one

API Declarations
Public Type SCROLLINFO
cbSize As Long
fMask As Long
nMin As Long
nMax As Long
nPage As Long
nPos As Long
nTrackPos As Long
End Type

Public Const WM_HSCROLL = &H114
Public Const WM_VSCROLL = &H115
' Scroll Bar Commands
Public Const SB_PAGEUP = 2
Public Const SB_PAGEDOWN = 3
Public Const SB_THUMBTRACK = 5
' Scroll Bar Constants
Public Const SB_HORZ = 0
Public Const SB_VERT = 1
Public Const SB_CTL = 2
Public Const SB_BOTH = 3
Public Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)

Rate Smooth Scrolling DataGrid (3(3 Vote))
Smooth Scrolling DataGrid.bas

Smooth Scrolling DataGrid Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters