Using Scroll Bars
This section contains topics that demonstrate how to create Scroll Bars.
In this section
|How to Create Scroll Bars
||When creating an overlapped, pop-up, or child window, you can add standard scroll bars by using the CreateWindowEx function and specifying WS_HSCROLL, WS_VSCROLL, or both styles.
|How to Scroll Text
||This section describes the changes you can make to an application's main window procedure to enable a user to scroll text. The example in this section creates and displays an array of text strings, and processes WM_HSCROLL and WM_VSCROLL scroll bar messages so that the user can scroll text both vertically and horizontally.
|How to Scroll a Bitmap
||This section describes changes you can make to an application's main window procedure to enable the user to scroll a bitmap.
The example includes a menu item that copies the screen content to a bitmap, and displays the bitmap in the client area. The example also processes the WM_HSCROLL and WM_VSCROLL messages that are generated by the scroll bars so that the user may scroll the bitmap horizontally and vertically. Unlike the example for scrolled text, the bitmap example employs the BitBlt function to draw the invalid portion of the client area.
|How to Create a Keyboard Interface for Standard Scroll Bars
||Although a scroll bar control provides a built-in keyboard interface, a standard scroll bar does not. To implement a keyboard interface for a standard scroll bar, a window procedure must process the WM_KEYDOWN message and examine the virtual-key code specified by the wParam parameter. If the virtual-key code corresponds to an arrow key, the window procedure sends itself a WM_HSCROLL or WM_VSCROLL message with the low-order word of the wParam parameter set to the appropriate scroll bar request code.