1.8.1 Standard Scroll Bars and Scroll-Bar Controls

A standard scroll bar is a part of the nonclient area of a window. It is created with the window and displayed when the window is displayed. The sole purpose of a standard scroll bar is to let users generate scrolling requests for the window's client area. A window has standard scroll bars if it is created with the WS_VSCROLL or WS_HSCROLL style. A standard scroll bar is either vertical or horizontal. A vertical bar always appears at the right of the client area; a horizontal bar always appears at the bottom. A standard scroll bar always has the standard scroll-bar height and width as defined by the SM_CXVSCROLL and SM_CYHSCROLL system metric values. (For more information, see the GetSystemMetrics function in Chapter 4, “Functions Directory.”)

A scroll-bar control is a control window that looks and acts like a standard scroll bar. But unlike a standard scroll bar, a scroll-bar control is not part of any window. As a separate window, a scroll-bar control can receive the input focus, and indicates this by displaying a flashing caret in the thumb. When a scroll-bar control has the input focus, the user can use the keyboard to direct the scrolling. Unlike standard scroll bars, a scroll-bar control provides a built-in keyboard interface. Scroll-bar controls also can be used for other purposes. For example, a scroll-bar control can be used to select values from a range of values, such as a color from a rainbow of colors.