Specifying Toolbar Size, Position, and Appearance (Windows CE 5.0)

Send Feedback

The window procedure for a toolbar automatically sets the size and position of the toolbar window. The height is based on the height of the buttons in the toolbar. The width is the same as the width of the parent window client area. The CCS_TOP and CCS_BOTTOM styles for common controls determine whether the toolbar is positioned along the top or the bottom of the client area. By default, a toolbar has the CCS_TOP style.

The window procedure for a toolbar automatically adjusts the size of the toolbar when it receives a WM_SIZE or a TB_AUTOSIZE message. An application should send either of these messages when the size of the parent window changes, or after sending a message that requires the size of the toolbar to be adjusted; for example, after sending the TB_SETBUTTONSIZE message.

Windows CE also supports messages that enable you to customize the look and behavior of toolbars and toolbar buttons.

Create transparent toolbars by specifying the TBSTYLE_FLAT style or the TBSTYLE_TRANSPARENT style. If you give a toolbar the TBSTYLE_FLAT style, the toolbar displays its buttons, but the toolbar itself is transparent. If you give a toolbar the TBSTYLE_TRANSPARENT style, the client area shows through the buttons, as well as through the underlying toolbar.

You can use image lists to customize the way in which a toolbar displays buttons in various states. You can set and retrieve image lists for toolbar buttons by using the TB_GETIMAGELIST and TB_SETIMAGELIST messages for buttons that are in their default, or not pressed, state, and the TB_GETDISABLEDIMAGELIST and TB_SETDISABLEDIMAGELIST messages for buttons that are in their disabled state. Use the TB_LOADIMAGES message to load images into a toolbar image list.

Windows CE supports a toolbar button style that is known as a drop-down button. When a user taps a button that has the TBSTYLE_DROPDOWN style, the toolbar sends a TBN_DROPDOWN message to its parent window. The parent window usually responds by displaying a pop-up menu or a list box under the drop-down button.

Because toolbars in Windows CE support the custom draw service, you can customize the appearance of a toolbar. If a toolbar provides this service, it sends the new NM_CUSTOMDRAW message at specific times during drawing operations. The lParam parameter of the NM_CUSTOMDRAW message is a pointer to an NMCUSTOMDRAW structure, which contains the data that is necessary to draw the customized toolbar.

See Also

Creating a Toolbar | Working with Common Controls | Creating Controls | Shell Application Development

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.