Visual Basic Classic
--
Questions
--
Followers
Top Experts
I would like to to scroll into Picture2 using my mouse wheel. So far i was using the VScroll1.
How can i do that?
Thanks for your help.
So far, i was doing:
Public Sub CheckKeyCode(KeyCode As Integer)
Dim nScrollValue As Double
Dim nOnePage As Integer
nOnePage = Me.VScroll1.Height
If KeyCode = vbKeyPageUp Or KeyCode = vbKeyPageDown Then
If KeyCode = vbKeyPageDown Then
nScrollValue = -Me.Picture2.Top + nOnePage
Else
nScrollValue = -Me.Picture2.Top - nOnePage
End If
If nScrollValue > Me.VScroll1.Max Then
nScrollValue = Me.VScroll1.Max
Me.Picture2.Top = -Me.VScroll1.Max
End If
If nScrollValue > 0 Then
Me.VScroll1.Value = nScrollValue
Else
Me.VScroll1.Value = 0
End If
End If
End Sub
Private Sub Form_Load()
VScroll1.Max = Picture2.Height - Picture1.Height
End Sub
Private Sub VScroll1_Scroll()
Picture2.Top = -(VScroll1.Value)
End Sub
mouse-scroll-wheel.zip
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
aikimark, I would say that the scoll works but not the way I would like it to scroll.
Example, If i click inside the scroll bar, let's say in the middle of it, i would like to go straight to the middle of the picture. I assume this is possible, but i was never able to do it.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015 and 2016
Experts Exchange Top Expert Visual Basic Classic 2012 to 2016
Visual Basic Classic
--
Questions
--
Followers
Top Experts
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.