Visual Basic 6 Black Book:Scroll Bars And Sliders
3. Close the Components box by clicking on OK.
4. The Flat Scroll Bar tool appears in the toolbox at this point. Add a flat scroll
bar to your form in the usual way.
5. Set the flat scroll bar’s Min, Max, SmallChange, and LargeChange values
as you want them.
6. Add the code you want to the scroll bar event you want, Change or Scroll.
For example, here we add code to a flat scroll bar’s Change event, updating a
text box with the setting of the scroll bar when the user is finished scrolling it:
Private Sub FlatScrollBar1_Change()
Text1.Text = "Scroll bar’s value: " & _
Run the program now, as shown in Figure 9.6. As you can see in that figure, the flat
scroll bar does indeed appear flat, but it functions like any other scroll bar when the
user scrolls it.
Figure 9.6 Adding a flat scroll bar to a program.
Unlike standard scroll bars, you can change the orientation of a flat scroll bar with its
Orientation property. The Orientation property can take these values:
• fsbVertical—0; vertical scroll bar
• fsbHorizontal—1; horizontal scroll bar
TIP: You can actually make a flat scroll bar appear 3D by setting its Appearance
property. This property can take these values: fsb3D (whose value is 0), fsbFlat
(value 1), and fsbTrack3D (value 2).
Customizing Flat Scroll Bar Arrows
Flat scroll bars have one advantage over standard scroll bars: you can disable either
arrow button selectively in a flat scroll bar using the Arrows property. You set the
Arrows property to one of these values:
• fsbBoth—0; enable both arrows
• fsbLeftUp—1; enable left/up arrow
• fsbRightDown—2; enable right/down arrow
For example, we set the flat scroll bar’s Arrows property to fsbLeftUp at design time
in Figure 9.7, which means the right button is disabled.
file:///E|/Program%20Files/KaZaA/My%20Shared%...Basic%20-%20%20Black%20Book/ch09/293-296.html (3 of 4) [7/31/2001 8:58:58 AM]