'(c) Richard C. Yarnell 1998 ' ryarnell@andrew.cmu.edu Option Explicit Private Sub Form_Load() 'set the lower bound for the horizontal 'scroll bar hscFrame.Min = 0 'set the upper bound for the horizontal 'scroll bar hscFrame.Max = picLarge.Width - picSmall.Width 'allow the viewport to scroll 1/10 of the 'width of the viewport when the scroll 'bar's arrows are clicked 'this ratio may be adjusted hscFrame.SmallChange = picSmall.Width / 10 'allow the viewport to scroll by one entire 'width of the viewport when the area between the 'scroll bar's handle and arrows is clicked hscFrame.LargeChange = picSmall.Width 'do the same things as above, but for the 'vertical scroll bar vscFrame.Min = 0 vscFrame.Max = picLarge.Height - picSmall.Height vscFrame.SmallChange = picSmall.Height / 10 vscFrame.LargeChange = picSmall.Height picLarge.Top = 0 picLarge.Left = 0 'call these events here to ensure that picLarge 'is positioned correctly at the start hscFrame_Change vscFrame_Change End Sub Private Sub hscFrame_Change() 'move picLarge left based on how much the 'scroll bar has moved right picLarge.Left = -hscFrame.Value End Sub Private Sub hscFrame_Scroll() 'call the hscFrame_Change event here so 'the scroll bar works when you drag the handle hscFrame_Change End Sub Private Sub vscFrame_Change() 'move picLarge up based on how much the 'scroll bar has moved down picLarge.Top = -vscFrame.Value End Sub Private Sub vscFrame_Scroll() 'call the vscFrame_Change event here so the 'scroll bar works when you drag the handle vscFrame_Change End Sub |