The new FlatScrollbar controls expose the ability to selectively disable their arrows. This is useful, for example, when the thumb indicator is at its minimum or maximum: |
Click here to copy the following block | Private Sub FlatScrollBar1_Change() If FlatScrollBar1.Value = FlatScrollBar1.Min Then FlatScrollBar1.Arrows = cc2RightDown ElseIf FlatScrollBar1.Value = FlatScrollBar1.Max Then FlatScrollBar1.Arrows = cc2LeftUp Else FlatScrollBar1.Arrows = cc2Both End If End Sub |
It turns out, however, that you can get the same effect even with standard scrollbars, by using the EnableScrollBar API function: |
This solution has only a minor drawback. When you reach the Min or Max value by clicking on arrow keys, the Change event fires and correctly disable the corresponding arrow, but as soon as you release the mouse VB re-enables it. This isn't a problem when you reach the Min or Max value by sliding the thumb indicator, or by using the arrow keys. If you want to be sure that you always get the correct result, just call the SetScrollbarArrows procedure from the Timer event procedure of a Timer control instead of the scrollbar's Change event: |
Finally, note that you can use the EnableScrollBar API to enable or disable the scrollbars that are associated to any control, such as a ListBox, ComboBox or TreeView control. In this case you must use the 2nd argument to identify which scrollbar you want to enable or disable. For example: |
|