BM_SETSTYLE

2.x

BM_SETSTYLE
wParam =  (WPARAM) LOWORD(dwStyle); /* style       */
lParam =  MAKELPARAM(fRedraw, 0);   /* redraw flag */

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

Parameters

dwStyle

Value of wParam. Specifies the button style. For an explanation of button styles, see the following Comments 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 Value

The return value is always zero.

Comments

The following are the button styles:

Value Meaning

BS_3STATE Creates a button that is the same as a check box, except that the box can be grayed (dimmed) as well as checked. The grayed state typically is used to show that a check box has been disabled.
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 normal.
BS_AUTOCHECKBOX Creates a button that is the same as a check box, except that an X appears in the check box when the user selects the box; the X disappears (is cleared) the next time the user selects the box.
BS_AUTORADIOBUTTON Creates a button that is the same as a radio button, except that when the user selects it, the button automatically highlights itself and clears (removes the selection from) any other buttons in the same group.
BS_CHECKBOX Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).
BS_DEFPUSHBUTTON Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style is useful for enabling the user to quickly select the most likely option (the default option).
BS_GROUPBOX Creates a rectangle in which other buttons 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.
BS_OWNERDRAW Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created, and it receives a WM_DRAWITEM message when a visual aspect of the button has changed. The BS_OWNERDRAW style cannot be combined 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 that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices.

An application should not attempt to change a button's type (for example, changing a radio button to a check box).

Example

This example sends a BM_SETSTYLE message to make a button become the default push button:

SendDlgItemMessage(hdlg, ID_MYPUSHBUTTON, BM_SETSTYLE,
    (WPARAM) BS_DEFPUSHBUTTON, TRUE);