The new vbAccelerator Site - more VB and .NET Code and Controls
Source Code
2 Common Controls Library &nbsp


NOTE: this code has been superceded by the version at the new site.



&nbsp

Flat Scroll Bars
With Internet Explorer 4.0, Microsoft have added some new styles of scroll bar to play with. These are called Flat Scroll bars, and display in three modes:

&nbsp
&nbsp &nbsp

[Regular Flat Scroll Bar]
With FSB_REGULAR_MODE the scroll bar appears as normal

[Encarta Style Flat Scroll Bar]
With FSB_ENCARTA_MODE the scroll bar appears flat, but a thin border appears when the mouse moves over. This is the same as the scroll bar which appears when you set IE4 to Fullscreen mode

[Flat Scroll Bar]
With FSB_FLAT_MODE the scroll bar appears flat and highlights flat when the mouse moves over

&nbsp
&nbsp

Download the FlatSBar project files (54kb)

Download the Flat Scroll Bar control only (14kb)


Your license to the code - what you can do

This sample requires the SSubTmr.DLL component. Make sure you have loaded and registered this before trying the FlatSBar project.

The sample project contains a new custom control designed in VB5, cFScroll.ocx. This control is designed to be a drop-in replacement for the standard VB scroll bar. Flat Scroll bars are only available if you have the version of COMCTL32.DLL supplied with IE4.0. This DLL can also be downloaded separately from the Microsoft site. (Note you must register with MSDN to follow this link, but it is free).

The first thing the code does on start up is check whether Flat Scroll bars are available by calling the InitialiseFlatSB entry point in COMCTL32.DLL. If this fails then the control falls back to the standard scroll bar API functions supplied with Win32.

The following table summarises the new and changed methods for cFScroll.ocx compared to the standard VB scroll bar:

&nbsp
&nbsp Method Change Description &nbsp
&nbsp ActiveBar New

The cFScroll.ocx control allows you to have:

  1. A Horizonal scroll bar
  2. A Vertical scroll bar
  3. Both Horizontal and Vertical scroll bars
If you only have one scroll bar in the control, you can ignore this member. If you have both, the control will look similar to this (here an Image control with a picture has been added as a child to the control):
[Both Scroll Bars]
In order to specify which scroll bar you are making settings for, set the ActiveBar to either:
  • efstHorizontal
  • efstVertical
&nbsp
&nbsp BorderStyle New

Sets the border style for the control. This is only really any use when you have both scroll bars on (see above)

&nbsp
&nbsp CanBeFlat New

This Read-only property returns whether the system supports flat scroll bars or not.

&nbsp
&nbsp Max Changed

The Maximum setting can be a full 32 bit value rather than being limited to 16 bits.

&nbsp
&nbsp Min Changed

The Minimum setting can be a full 32 bit value rather than being limited to 16 bits.

&nbsp
&nbsp Orientation New

Rather than have separate controls for Horizontal and Vertical scroll bars, this control provides both scroll types in the same control. In addition, you can have both Horizontal and Vertical scrolling in the same control. The settings for this are:

  • efsoHorizontal - Horizontal scroll bar
  • efsoVertical - Vertical scroll bar
  • efsoBoth - Both Horizontal and Vertical scroll bars
&nbsp
&nbsp Style New

This property allows you to set the control's appearance, as shown in the diagrams at the top of the page. The settings for this are:

  • efsRegular
  • efsEncarta
  • efsFlat
If the system supports flat scroll bars (see the CanBeFlat property), the default appearance is efsFlat, otherwise it is efsRegular and cannot be changed.
&nbsp
&nbsp AutoRedraw, hDC, Refresh, ScaleWidth, ScaleHeight New

These properties are provided to allow you to draw into the client (non-scroll bar) area of the control with API drawing methods. The methods work in the same way as for a PictureBox.

&nbsp
&nbsp


TopBack to top

Source Code - What We're About!Back to Source Code

&nbsp

AboutContributeSend FeedbackPrivacy

Copyright 1998-1999, Steve McMahon ( steve@vbaccelerator.com). All Rights Reserved.
Last updated: 22 November 1998