Condividi tramite


CToolBar::SetButtonStyle

Call this member function to set the style of a button or separator, or to group buttons.

void SetButtonStyle(
   int nIndex,
   UINT nStyle 
);

Parameters

  • nIndex
    Index of the button or separator whose information is to be set.

  • nStyle
    The button style. The following button styles are supported:

    • TBBS_BUTTON   Standard pushbutton (default)

    • TBBS_SEPARATOR   Separator

    • TBBS_CHECKBOX   Auto check-box button

    • TBBS_GROUP   Marks the start of a group of buttons

    • TBBS_CHECKGROUP   Marks the start of a group of check-box buttons

    • TBBS_DROPDOWN   Creates a drop-down list button

    • TBBS_AUTOSIZE   The button's width will be calculated based on the text of the button, not on the size of the image

    • TBBS_NOPREFIX   The button text will not have an accelerator prefix associated with it

Remarks

A button's style determines how the button appears and how it responds to user input.

Before calling SetButtonStyle, call the GetButtonStyle member function to retrieve the button or separator style.

Nota

You can also set button states using the nStyle parameter; however, because button states are controlled by the ON_UPDATE_COMMAND_UI handler, any state you set using SetButtonStyle will be lost during the next idle processing. See How to Update User-Interface Objects and TN031: Control Bars for more information.

Requirements

Header: afxext.h

See Also

Reference

CToolBar Class

Hierarchy Chart

CToolBar::GetButtonStyle

Other Resources

CToolBar Members