Düzenle

Aracılığıyla paylaş


Toolbar Control and Button Styles

The following window styles are specific to toolbars. They are combined with other window styles when the toolbar is created.

Note For Common Controls version 6.00, if a visual style is being used with the toolbar, buttons are always transparent regardless of the style setting. Otherwise, transparency behavior is normal as indicated by the use of the TBSTYLE_FLAT or TBSTYLE_TRANSPARENT style.

Note

Comctl32.dll version 6 is not redistributable but it is included in Windows. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Enabling Visual Styles.

Constant Description
TBSTYLE_ALTDRAG
Allows users to change a toolbar button's position by dragging it while holding down the ALT key. If this style is not specified, the user must hold down the SHIFT key while dragging a button. Note that the CCS_ADJUSTABLE style must be specified to enable toolbar buttons to be dragged.
TBSTYLE_CUSTOMERASE
Version 4.70. Generates NM_CUSTOMDRAW notification codes when the toolbar processes WM_ERASEBKGND messages.
TBSTYLE_FLAT
Version 4.70. Creates a flat toolbar. In a flat toolbar, both the toolbar and the buttons are transparent and hot-tracking is enabled. Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the toolbar control becomes visible.
TBSTYLE_LIST
Version 4.70. Creates a flat toolbar with button text to the right of the bitmap. Otherwise, this style is identical to TBSTYLE_FLAT. To prevent repainting problems, this style should be set before the toolbar control becomes visible.
TBSTYLE_REGISTERDROP
Version 4.71. Generates TBN_GETOBJECT notification codes to request drop target objects when the cursor passes over toolbar buttons.
TBSTYLE_TOOLTIPS
Creates a tooltip control that an application can use to display descriptive text for the buttons in the toolbar.
TBSTYLE_TRANSPARENT
Version 4.71. Creates a transparent toolbar. In a transparent toolbar, the toolbar is transparent but the buttons are not. Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the toolbar control becomes visible.
TBSTYLE_WRAPABLE
Creates a toolbar that can have multiple lines of buttons. Toolbar buttons can "wrap" to the next line when the toolbar becomes too narrow to include all buttons on the same line. When the toolbar is wrapped, the break will occur on either the rightmost separator or the rightmost button if there are no separators on the bar. This style must be set to display a vertical toolbar control when the toolbar is part of a vertical rebar control. This style cannot be combined with CCS_VERT.

Note: A toolbar button can have a combination of the following styles. To specify a button style, set the appropriate flags in the fsStyle member of the button's TBBUTTON structure. Not all styles can be combined.

For Shell version 4.72 and earlier, both window and button style flags had the form TBSTYLE_XXX. If you are compiling an application with version 4.72 or earlier of Commctrl.h, you must use the TBSTYLE_XXX button style flags. For version 5.80 and later, all button styles have the form BTNS_XXX. All of the TBSTYLE_XXX values have equivalent BTNS_XXX values, with the same meaning and numerical value. For convenience, both forms are given in the following table.

Constant Description
BTNS_AUTOSIZE
Version 5.80. Specifies that the toolbar control should not assign the standard width to the button. Instead, the button's width will be calculated based on the width of the text plus the image of the button. Use the equivalent style flag, TBSTYLE_AUTOSIZE, for version 4.72 and earlier.
BTNS_BUTTON
Version 5.80. Creates a standard button. Use the equivalent style flag, TBSTYLE_BUTTON, for version 4.72 and earlier. This flag is defined as 0, and should be used to signify that no other flags are set.
BTNS_CHECK
Version 5.80. Creates a dual-state push button that toggles between the pressed and nonpressed states each time the user clicks it. The button has a different background color when it is in the pressed state. Use the equivalent style flag, TBSTYLE_CHECK, for version 4.72 and earlier.
BTNS_CHECKGROUP
Version 5.80. Creates a button that stays pressed until another button in the group is pressed, similar to option buttons (also known as radio buttons). It is equivalent to combining BTNS_CHECK and BTNS_GROUP. Use the equivalent style flag, TBSTYLE_CHECKGROUP, for version 4.72 and earlier.
BTNS_DROPDOWN
Version 5.80. Creates a drop-down style button that can display a list when the button is clicked. Instead of the WM_COMMAND message used for normal buttons, drop-down buttons send a TBN_DROPDOWN notification code. An application can then have the notification handler display a list of options. Use the equivalent style flag, TBSTYLE_DROPDOWN, for version 4.72 and earlier.
If the toolbar has the TBSTYLE_EX_DRAWDDARROWS extended style, drop-down buttons will have a drop-down arrow displayed in a separate section to their right. If the arrow is clicked, a TBN_DROPDOWN notification code will be sent. If the associated button is clicked, a WM_COMMAND message will be sent.
BTNS_GROUP
Version 5.80. When combined with BTNS_CHECK, creates a button that stays pressed until another button in the group is pressed. Use the equivalent style flag, TBSTYLE_GROUP, for version 4.72 and earlier.
BTNS_NOPREFIX
Version 5.80. Specifies that the button text will not have an accelerator prefix associated with it. Use the equivalent style flag, TBSTYLE_NOPREFIX, for version 4.72 and earlier.
BTNS_SEP
Version 5.80. Creates a separator, providing a small gap between button groups. A button that has this style does not receive user input. Use the equivalent style flag, TBSTYLE_SEP, for version 4.72 and earlier.
BTNS_SHOWTEXT
Version 5.81. Specifies that button text should be displayed. All buttons can have text, but only those buttons with the BTNS_SHOWTEXT button style will display it. This button style must be used with the TBSTYLE_LIST style and the TBSTYLE_EX_MIXEDBUTTONS extended style. If you set text for buttons that do not have the BTNS_SHOWTEXT style, the toolbar control will automatically display it as a tooltip when the cursor hovers over the button. This feature allows your application to avoid handling the TBN_GETINFOTIP or TTN_GETDISPINFO notification code for the toolbar.
BTNS_WHOLEDROPDOWN
Version 5.80. Specifies that the button will have a drop-down arrow, but not as a separate section. Buttons with this style behave the same, regardless of whether the TBSTYLE_EX_DRAWDDARROWS extended style is set.
TBSTYLE_AUTOSIZE
Equivalent to BTNS_AUTOSIZE. Use TBSTYLE_AUTOSIZE for version 4.72 and earlier.
TBSTYLE_BUTTON
Equivalent to BTNS_BUTTON. Use TBSTYLE_BUTTON for version 4.72 and earlier.
TBSTYLE_CHECK
Equivalent to BTNS_CHECK. Use TBSTYLE_CHECK for version 4.72 and earlier.
TBSTYLE_CHECKGROUP
Equivalent to BTNS_CHECKGROUP. Use TBSTYLE_CHECKGROUP for version 4.72 and earlier.
TBSTYLE_DROPDOWN
Equivalent to BTNS_DROPDOWN. Use TBSTYLE_DROPDOWN for version 4.72 and earlier.
TBSTYLE_GROUP
Equivalent to BTNS_GROUP. Use TBSTYLE_GROUP for version 4.72 and earlier.
TBSTYLE_NOPREFIX
Equivalent to BTNS_NOPREFIX. Use TBSTYLE_NOPREFIX for version 4.72 and earlier.
TBSTYLE_SEP
Equivalent to BTNS_SEP. Use TBSTYLE_SEP for version 4.72 and earlier.

Requirements

Requirement Value
Header
CommCtrl.h