|
Standard Scroll Bars and Scroll Bar Controls
A scroll bar is included in a window either as a standard scroll bar or as a
scroll bar control. A standard scroll bar is located in 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 enable the user to generate scrolling requests for viewing the
entire content of the client area. You can include a standard scroll bar in a
window by specifying WS_HSCROLL, WS_VSCROLL, or both styles when you create the
window. The WS_HSCROLL style creates a horizontal scroll bar positioned at the
bottom of the client area. The WS_VSCROLL style creates a vertical scroll bar
positioned at the right of the client area. The SM_CXHSCROLL and SM_CYHSCROLL system
metric values define the width and height of a standard horizontal scroll bar.
The SM_CXVSCROLL and SM_CYVSCROLL values define the width and height of a
standard vertical scroll bar.
A scroll bar control is a control window that belongs to the SCROLLBAR window class. A scroll bar
control appears and functions like a standard scroll bar, but it is a separate
window. As a separate window, a scroll bar control receives direct input focus,
indicated by a flashing caret displayed in the scroll box. Unlike a standard
scroll bar, a scroll bar control also has a built-in keyboard interface that
enables the user to direct scrolling. You can use as many scroll bar controls as
needed in a single window. When you create a scroll bar control, you must
specify the scroll bar's size and position. However, if a scroll bar control's window
can be resized, adjustments to the scroll bar's size must be made whenever the
size of the window changes.
The advantage of using a standard scroll bar is that Windows creates the
scroll bar and automatically sets its size and position. However, standard scroll
bars are sometimes too restrictive. For example, suppose that you want to divide
a client area into quadrants and use a separate set of scroll bars to control
the content of each quadrant. You cannot use standard scroll bars because you
can only create one set of scroll bars for a particular window. Use scroll bar
controls instead, because you can add as many of them to a window as you want.
Applications can provide scroll bar controls for purposes other than scrolling
the content of a window. For example, a screen saver application might provide
a scroll bar for setting the speed at which graphics are moved about on the
screen.
A scroll bar control can have a number of styles that serves to control the
orientation and position of the scroll bar. You specify the styles that you want
when you call the CreateWindowEx function to create a scroll bar control. Some of the styles create a scroll
bar control that uses a default width or height. However, you must always
specify the x- and y-coordinates and the other dimensions of the scroll bar.
Following are the scroll bar control styles.
| Aligns the bottom edge of the scroll bar with the bottom edge of the rectangle
defined by the CreateWindowEx parameters x, y, nWidth, and nHeight. The scroll bar has the default height for system scroll bars. Use this style
with the SBS_HORZ style.
|
| Designates a horizontal scroll bar. If neither the SBS_BOTTOMALIGN nor
SBS_TOPALIGN style is specified, the scroll bar has the height, width, and position
specified by the parameters of CreateWindowEx.
|
| Aligns the left edge of the scroll bar with the left edge of the rectangle
defined by the parameters of CreateWindowEx. The scroll bar has the default width for system scroll bars. Use this style
with the SBS_VERT style.
|
| Aligns the right edge of the scroll bar with the right edge of the rectangle
defined by the parameters of CreateWindowEx. The scroll bar has the default width for system scroll bars. Use this style
with the SBS_VERT style.
|
| Designates a size box. If you specify neither the SBS_SIZEBOXBOTTOMRIGHTALIGN
nor the SBS_SIZEBOXTOPLEFTALIGN style, the size box has the height, width, and
position specified by the parameters of CreateWindowEx.
|
SBS_SIZEBOXBOTTOMRIGHTALIGN
|
|
| Aligns the lower right corner of the size box with the lower right corner of
the rectangle specified by the parameters of CreateWindowEx. The size box has the default size for system size boxes. Use this style with
the SBS_SIZEBOX style.
|
| Aligns the upper left corner of the size box with the upper left corner of the
rectangle specified by the parameters of CreateWindowEx. The size box has the default size for system size boxes. Use this style with
the SBS_SIZEBOX style.
|
| Same as SBS_SIZEBOX, but with a raised edge (version 4.0 or later).
|
| Aligns the top edge of the scroll bar with the top edge of the rectangle
defined by the parameters of CreateWindowEx. The scroll bar has the default height for system scroll bars. Use this style
with the SBS_HORZ style.
|
| Designates a vertical scroll bar. If you specify neither the SBS_RIGHTALIGN
nor the SBS_LEFTALIGN style, the scroll bar has the height, width, and position
specified by the parameters of CreateWindowEx.
|
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|