The size of the scroll bar control slider is directly proportional to the difference between the values โโof this ScrollBarName.Maximum
control ScrollBarName.Maximum
and ScrollBarName.LargeChange
.
To use ScrollBarName.LargeChange
you need a proportional offset value for ScrollBarName.Maximum
so that the scrollbar control behaves as intended when used. The following example demonstrates how this displacement calculation is performed and how it is applied in the context of a practical application.
Offset calculation:
ScrollBarName.Maximum = MyMaximum + MyLargeChange - 1 ' LargeChange Usage Offset Calcualtion
Application Context:
'*** Using Simplified Values To Avoid Confusion *** Dim ScrollBarName As New VScrollBar ' Or HScrollBar Control Dim MyMaximum As Integer = 100 ' Your "off screen" calculated value Dim MySmallChange As Integer = 10 ' MySmallChange <= MyLargeChange <= MyMaximum Dim MyLargeChange As Integer = 50 ' MyLargeChange <= MyMaximum (Example produces thumbar sized {(MyLargeChange / ScrollBarName.Maximum) %} Clientsize.width Me.controls.add(ScrollBarName) ' Add Your Control ScrollBarName.Dock = DockStyle.Right ' Dock bottom for HScrollBar ScrollBarName.SmallChange = MySmallChange ScrollBarName.LargeChange = MyLargeChange ScrollBarName.Maximum = MyMaximum + MyLargeChange - 1 ' LargeChange Usage Offset Calcualtion ScrollBarName.Value = 20 ' The scrollBar movement value whereby ScrollBarName.Value <= MyMaximum
Jamie source share