In the scroll event of the scrollbar, you have to go through every control on the form and increase or decrease its .top value in accordance with the .value of the scrollbar.
One method would be to add an MDI form to your project, and then make your form an MDI child. Set the borders of your form to none. You may also want to set the caption of the MDI form to be the same as that of your original form.
And that's it. You should not need to change or write any additional code. The one caveat is that MDI children cannot be shown modally.
This code works great for me. Let me know how it works for you.
Dim VPos As Integer
Private Sub VScroll1_Change()
Call ScrollForm(0)
End Sub
Private Sub VScroll1_Scroll()
Call ScrollForm(0)
End Sub
Public Sub ScrollForm(Direction As Byte)
Dim ctl As Control
'Scroll Vertically
If Direction = 0 Then
For Each ctl In Me.Controls
'Make sure it's not a ScrollBar
If Not (TypeOf ctl Is VScrollBar) Then
'If it's a Line then
If TypeOf ctl Is Line Then
ctl.Y1 = ctl.Y1 + VPos - VScroll1.Value
ctl.Y2 = ctl.Y2 + VPos - VScroll1.Value
Else
ctl.Top = ctl.Top + VPos - VScroll1.Value
End If
End If
Next
VPos = VScroll1.Value
End If
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.