Flat Scroll Bars
Microsoft® Internet Explorer Version 4.0 introduced a new visual technology called flat scroll bars. Functionally, flat scroll bars behave just like standard scroll bars. The difference is that you can customize their appearance to a greater extent than standard scroll bars. The following illustration shows a window that contains a flat scroll bar. 
 Note Flat scroll bar APIs are implemented in version 4.71 and later of Comctl32.dll. Using Flat Scroll BarsFlat Scroll Bars ReferenceUsing Flat Scroll Bars
This section describes how to implement flat scroll bars in your application. Before You Begin
To use the flat scroll bar APIs, you must include Commctrl.h in your source files and link with Comctl32.lib. Adding Flat Scroll Bars to a Window
To add flat scroll bars to a window, call InitializeFlatSB, passing the handle to the window. Instead of using the standard scroll bar functions to manipulate your scroll bars, you must use the equivalent FlatSB_XXX function. There are flat scroll bar functions for setting and retrieving the scroll information, range, and position. If flat scroll bars haven't been initialized for your window, the flat scroll bar API will defer to the corresponding standard functions, if any are used. This allows you to turn flat scroll bars on and off without having to write conditional code.Because an application may have set custom metrics for its flat scroll bars, they are not automatically updated when system metrics change. When the system scroll bar metrics change, a WM_SETTINGCHANGE message is broadcast, with its wParam set to SPI_SETNONCLIENTMETRICS. To update flat scroll bars to the new system metrics, applications must handle this message and change the flat scroll bar's metric-dependent properties explicitly.To update your scroll bar properties, use FlatSB_SetScrollProp. The following code fragment changes a flat scroll bar's metric dependent properties to the current system values.void FlatSB_UpdateMetrics(HWND hWnd)
{
FlatSB_SetScrollProp(hWnd, WSB_PROP_CXVSCROLL, GetSystemMetrics(SM_CXVSCROLL), FALSE);
FlatSB_SetScrollProp(hWnd, WSB_PROP_CXHSCROLL, GetSystemMetrics(SM_CXHSCROLL), FALSE);
FlatSB_SetScrollProp(hWnd, WSB_PROP_CYVSCROLL, GetSystemMetrics(SM_CYVSCROLL), FALSE);
FlatSB_SetScrollProp(hWnd, WSB_PROP_CYHSCROLL, GetSystemMetrics(SM_CYHSCROLL), FALSE);
FlatSB_SetScrollProp(hWnd, WSB_PROP_CXHTHUMB, GetSystemMetrics(SM_CXHTHUMB), FALSE);
FlatSB_SetScrollProp(hWnd, WSB_PROP_CYVTHUMB, GetSystemMetrics(SM_CYVTHUMB), TRUE);
}Enhancing Flat Scroll Bars
FlatSB_SetScrollProp allows you to modify the flat scroll bars to customize the look of your window. For vertical scroll bars, you can change the width of the bar and the height of the direction arrows. For horizontal scroll bars, you can change the height of the bar and the width of the direction arrows. You can also change the background color of both the horizontal and vertical scroll bars. FlatSB_SetScrollProp also allows you to customize how the flat scroll bars are displayed. By changing the WSB_PROP_VSTYLE and WSB_PROP_HSTYLE properties, you can set the type of scroll bar that you wish to use. Three styles are available. FSB_ENCARTA_MODE  A standard flat scroll bar is displayed. When the mouse moves over a direction button or the thumb, that portion of the scroll bar will be displayed in 3-D. 
FSB_FLAT_MODE  A standard flat scroll bar is displayed. When the mouse moves over a direction button or the thumb, that portion of the scroll bar will be displayed in inverted colors. 
FSB_REGULAR_MODE  A normal, nonflat scroll bar is displayed. No special visual effects will be applied. 
Removing Flat Scroll Bars
If you wish to remove flat scroll bars from your window, call the UninitializeFlatSB API, passing the handle to the window. This API only removes flat scroll bars from your window at run time. You do not need to call this API when your window is destroyed. 

解决方案 »

  1.   

    Flat Scroll Bars
    Microsoft® Internet Explorer Version 4.0 introduced a new visual technology called flat scroll bars. Functionally, flat scroll bars behave just like standard scroll bars. The difference is that you can customize their appearance to a greater extent than standard scroll bars. The following illustration shows a window that contains a flat scroll bar. 
     Note Flat scroll bar APIs are implemented in version 4.71 and later of Comctl32.dll. Using Flat Scroll BarsFlat Scroll Bars ReferenceUsing Flat Scroll Bars
    This section describes how to implement flat scroll bars in your application. Before You Begin
    To use the flat scroll bar APIs, you must include Commctrl.h in your source files and link with Comctl32.lib. Adding Flat Scroll Bars to a Window
    To add flat scroll bars to a window, call InitializeFlatSB, passing the handle to the window. Instead of using the standard scroll bar functions to manipulate your scroll bars, you must use the equivalent FlatSB_XXX function. There are flat scroll bar functions for setting and retrieving the scroll information, range, and position. If flat scroll bars haven't been initialized for your window, the flat scroll bar API will defer to the corresponding standard functions, if any are used. This allows you to turn flat scroll bars on and off without having to write conditional code.Because an application may have set custom metrics for its flat scroll bars, they are not automatically updated when system metrics change. When the system scroll bar metrics change, a WM_SETTINGCHANGE message is broadcast, with its wParam set to SPI_SETNONCLIENTMETRICS. To update flat scroll bars to the new system metrics, applications must handle this message and change the flat scroll bar's metric-dependent properties explicitly.To update your scroll bar properties, use FlatSB_SetScrollProp. The following code fragment changes a flat scroll bar's metric dependent properties to the current system values.void FlatSB_UpdateMetrics(HWND hWnd)
    {
    FlatSB_SetScrollProp(hWnd, WSB_PROP_CXVSCROLL, GetSystemMetrics(SM_CXVSCROLL), FALSE);
    FlatSB_SetScrollProp(hWnd, WSB_PROP_CXHSCROLL, GetSystemMetrics(SM_CXHSCROLL), FALSE);
    FlatSB_SetScrollProp(hWnd, WSB_PROP_CYVSCROLL, GetSystemMetrics(SM_CYVSCROLL), FALSE);
    FlatSB_SetScrollProp(hWnd, WSB_PROP_CYHSCROLL, GetSystemMetrics(SM_CYHSCROLL), FALSE);
    FlatSB_SetScrollProp(hWnd, WSB_PROP_CXHTHUMB, GetSystemMetrics(SM_CXHTHUMB), FALSE);
    FlatSB_SetScrollProp(hWnd, WSB_PROP_CYVTHUMB, GetSystemMetrics(SM_CYVTHUMB), TRUE);
    }Enhancing Flat Scroll Bars
    FlatSB_SetScrollProp allows you to modify the flat scroll bars to customize the look of your window. For vertical scroll bars, you can change the width of the bar and the height of the direction arrows. For horizontal scroll bars, you can change the height of the bar and the width of the direction arrows. You can also change the background color of both the horizontal and vertical scroll bars. FlatSB_SetScrollProp also allows you to customize how the flat scroll bars are displayed. By changing the WSB_PROP_VSTYLE and WSB_PROP_HSTYLE properties, you can set the type of scroll bar that you wish to use. Three styles are available. FSB_ENCARTA_MODE  A standard flat scroll bar is displayed. When the mouse moves over a direction button or the thumb, that portion of the scroll bar will be displayed in 3-D. 
    FSB_FLAT_MODE  A standard flat scroll bar is displayed. When the mouse moves over a direction button or the thumb, that portion of the scroll bar will be displayed in inverted colors. 
    FSB_REGULAR_MODE  A normal, nonflat scroll bar is displayed. No special visual effects will be applied. 
    Removing Flat Scroll Bars
    If you wish to remove flat scroll bars from your window, call the UninitializeFlatSB API, passing the handle to the window. This API only removes flat scroll bars from your window at run time. You do not need to call this API when your window is destroyed. 
      

  2.   

    jiangsheng(蒋晟.Net) :   这个我用过,做出来的滚动条不能拖动,不信你试试!
      

  3.   

    September 1998
    Microsoft System Journal
    Control Spy Exposes the Clandestine Life of Windows Common Controls, Part II
    Download ControlSpy.exe (2,914KB)这里有示例代码
    这个例子没有问题,我试过
      

  4.   

    September 1998
    Microsoft System Journal
    Control Spy Exposes the Clandestine Life of Windows Common Controls, Part II
    Download ControlSpy.exe (2,914KB)这里有示例代码
    这个例子没有问题,我试过