Prev Next

BM_SETSTYLE Overview  Group

An application sends a BM_SETSTYLE message to change the style of a button.

BM_SETSTYLE 

wParam =  (WPARAM) LOWORD(dwStyle); // style 

lParam =  MAKELPARAM(fRedraw, 0);   // redraw flag 

 

Parameters

dwStyle
Value of wParam. Specifies the button style. For an explanation of button styles, see the following Remarks section.
fRedraw
Value of the low-order word of lParam. Specifies whether the button is to be redrawn. A value of TRUE redraws the button; a value of FALSE does not redraw the button.

Return Values

This message always returns zero.

Remarks

Following are the available button styles:

Style

Meaning

BS_3STATE

Creates a button that is the same as a check box, except that the box can be grayed as well as checked or unchecked. Use the grayed state to show that the state of the check box is not determined.

BS_AUTO3STATE

Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and unchecked.

BS_AUTOCHECKBOX

Creates a button that is the same as a check box, except that the check state automatically toggles between checked and unchecked each time the user selects the check box.

BS_AUTORADIOBUTTON

Creates a button that is the same as a radio button, except that when the user selects it, Windows automatically sets the button’s check state to checked and automatically sets the check state for all other buttons in the same group to unchecked.

BS_CHECKBOX

Creates a small, empty check box with text. By default, the text is displayed to the right of the check box. To display the text to the left of the check box, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style).

BS_DEFPUSHBUTTON

Creates a push button that behaves like a BS_PUSHBUTTON style button, but also has a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.

BS_GROUPBOX

Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle’s upper left corner.

BS_LEFTTEXT

Places text on the left side of the radio button or check box when combined with a radio button or check box style. Same as the BS_RIGHTBUTTON style.

BS_OWNERDRAW

Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created and a WM_DRAWITEM message when a visual aspect of the button has changed. Do not combine the BS_OWNERDRAW style with any other button styles.

BS_PUSHBUTTON

Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.

BS_RADIOBUTTON

Creates a small circle with text. By default, the text is displayed to the right of the circle. To display the text to the left of the circle, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style). Use radio buttons for groups of related, but mutually exclusive choices.

BS_USERBUTTON

Obsolete, but provided for compatibility with 16-bit versions of Windows. Win32-based applications should use BS_OWNERDRAW instead.

BS_BITMAP

Specifies that the button displays a bitmap.

BS_BOTTOM

Places text at the bottom of the button rectangle.

BS_CENTER

Centers text horizontally in the button rectangle.

BS_ICON

Specifies that the button displays an icon.

BS_LEFT

Left-justifies the text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is left justified on the right side of the check box or radio button.

BS_MULTILINE

Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.

BS_NOTIFY

Enables a button to send BN_DBLCLK, BN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style.

BS_PUSHLIKE

Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn’t pushed or checked, and sunken when it is pushed or checked.

BS_RIGHT

Right-justifies text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is right justified on the right side of the check box or radio button.

BS_RIGHTBUTTON

Positions a radio button’s circle or a check box’s square on the right side of the button rectangle. Same as the BS_LEFTTEXT style.

BS_TEXT

Specifies that the button displays text.

BS_TOP

Places text at the top of the button rectangle.

BS_VCENTER

Places text in the middle (vertically) of the button rectangle.

See Also

WM_COMMAND, WM_DRAWITEM, WM_MEASUREITEM