共用方式為


Button Styles

  • BS_3STATE   Same as a check box, except that the box can be dimmed as well as checked. The dimmed state typically is used to show that a check box has been disabled.

  • BS_AUTO3STATE   Same as a three-state check box, except that the box changes its state when the user selects it.

  • BS_AUTOCHECKBOX   Same as a check box, except that a check mark appears in the check box when the user selects the box; the check mark disappears the next time the user selects the box.

  • BS_AUTORADIOBUTTON   Same as a radio button, except that when the user selects it, the button automatically highlights itself and removes the selection from any other radio buttons with the same style in the same group.

  • 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_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 enables the user to quickly select the most likely option (the default option).

  • BS_FLAT   Specifies that the button is two-dimensional; it does not use the default shading to create a 3-D image.

  • 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_ICON   Specifies that the button displays an icon.

  • BS_LEFT   Left aligns 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 aligned on the right side of the check box or radio button.

  • BS_LEFTTEXT   When combined with a radio-button or check-box style, the text appears on the left side of the radio button or check box.

  • 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_OWNERDRAW   Creates an owner-drawn button. The framework calls the DrawItem member function when a visual aspect of the button has changed. This style must be set when using the CBitmapButton class.

  • BS_PUSHBUTTON   Creates a pushbutton that posts a WM_COMMAND message to the owner window when the user selects the button.

  • 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_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.

  • BS_RIGHT   Right aligns 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 right aligned 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_USERBUTTON   Obsolete, but provided for compatibility with 16-bit versions of Windows. Win32-based applications should use BS_OWNERDRAW instead.

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

  • BS_SPLITBUTTON   Creates a split button. A split button has a main area and a drop-down arrow. The button performs a default action when you click the main area. By default, the button displays a menu of options when you click the drop-down arrow.

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

  • BS_COMMANDLINK   Creates a command link button.

  • BS_DEFCOMMANDLINK   Creates a default command link button that behaves like a BS_PUSHBUTTON style command link button. If the button is in a dialog box, the user can select the command link button by pressing the ENTER key, even when the command link button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.

See Also

Concepts

Styles Used by MFC

CButton::Create

Button Styles