Control Two Scroll Bars From Either

computer_guy

Member
Joined
Apr 29, 2005
Messages
7
Programming Experience
1-3
Hello All,

I have two panels with picture boxes within, both have scroll bars because the images are too large for the panel. I'm trying to figure a way to control both horizontal scroll bars while scrolling either horizontal scroll bar on either panel. Another way of putting it, if I have two panels I would like to scroll both panels by either using the top scroll bar or the bottom scroll bar, it would cause both panels to scroll the same positions. Anyone have any idea's?

Regards:rolleyes:
 
In each panels Scroll event set Value of the panels VerticalScroll and HorizontalScroll equal to the other. (ie panel123.HorizontalScroll.Value)
 
I tried this but does'nt work:

Private Sub Panel1_Scroll(ByVal sender As Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles Panel1.Scroll
Panel2.AutoScrollPosition =
New Point(Panel1.AutoScrollPosition.X, Panel1.AutoScrollPosition.Y)
End Sub

Private Sub Panel2_Scroll(ByVal sender As Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles Panel2.Scroll
Panel1.AutoScrollPosition =
New Point(Panel2.AutoScrollPosition.X, Panel2.AutoScrollPosition.Y)
End Sub
 
Back
Top