Styles Used by MFC

Use the following style flags to specify window or control appearance and behavior when you create the corresponding MFC object. In most cases, these styles are set in the dwStyle parameter of the class Create function.

Button styles

Button styles apply to CButton Class objects, such as radio buttons, check boxes and pushbuttons. Specify a combination of styles in the dwStyle parameter of CButton::Create. For more information on button styles in Windows, see Button Styles (Windows).

Button types

The following table lists button types. You can optionally choose one of the following. If you do not specify a button type, the default is BS_PUSHBUTTON.

Type Description
BS_3STATE Creates a check box button with three states: BST_CHECKED, BST_INDETERMINATE, and BST_UNCHECKED. Clicking on the button sends a BN_CLICKED notification to the owner window but does not change the state of the button. By default, associated text is displayed to the right of the check box. To display text to the left of the check box, use the BS_LEFTTEXT or BS_RIGHTBUTTON style.
BS_AUTO3STATE Creates a check box button with three states: BST_CHECKED, BST_INDETERMINATE, and BST_UNCHECKED. Clicking on the button sends a BN_CLICKED notification to the owner window and changes the state of the button. The button states cycle in the order of BST_CHECKED, BST_INDETERMINATE, and BST_UNCHECKED. By default, associated text is displayed to the right of the check box. To display text to the left of the check box, use the BS_LEFTTEXT or BS_RIGHTBUTTON style.
BS_AUTOCHECKBOX Creates a check box button with two states: BST_CHECKED and BST_UNCHECKED. Clicking on the button sends a BN_CLICKED notification to the owner window and changes the state of the button. By default, associated text is displayed to the right of the check box. To display text to the left of the check box, use the BS_LEFTTEXT or BS_RIGHTBUTTON style.
BS_AUTORADIOBUTTON Creates a radio button with two states: BST_CHECKED and BST_UNCHECKED. Radio buttons are usually used in groups, with each group having a maximum of one checked option at a time. Clicking on the button sends a BN_CLICKED notification to the owner window, sets the state of the clicked radio button to BST_CHECKED, and sets the states of all other radio buttons in the button group to BST_UNCHECKED. By default, associated text is displayed to the right of the radio button. To display text to the left of the radio button, use the BS_LEFTTEXT or BS_RIGHTBUTTON style.
BS_CHECKBOX Creates a check box button with two states: BST_CHECKED and BST_UNCHECKED. Clicking on the button sends a BN_CLICKED notification to the owner window but does not change the state of the button. By default, associated text is displayed to the right of the check box. To display text to the left of the check box, use the BS_LEFTTEXT or BS_RIGHTBUTTON style.
BS_COMMANDLINK Creates a command link button. A command link button is a command button specific to Windows Vista that displays a green arrow to the left of the main text and a note below the main text. You can set the note text using CButton::SetNote.
BS_DEFCOMMANDLINK Creates a command link button. A command link button is a command button specific to Windows Vista that displays a green arrow to the left of the main text and a note below the main text. You can set the note text using CButton::SetNote. If the button is in a dialog box, pressing the ENTER key sends a BN_CLICKED notification to the dialog box even when the button does not have the input focus.
BS_DEFPUSHBUTTON Creates a command button that has a heavy black border. If the button is in a dialog box, pressing the ENTER key sends a BN_CLICKED notification to the dialog box even when the button does not have the input focus.
BS_DEFSPLITBUTTON Creates a split button. A split button is a command button specific to Windows Vista that contains a button adjacent to a drop-down arrow. When you click the button, the default command is executed. When you click the drop-down arrow, a menu of additional commands appears. If the split button is in a dialog box, pressing the ENTER key sends a BN_CLICKED notification to the dialog box even when the button does not have the input focus
BS_GROUPBOX Creates a rectangle in which other buttons can be grouped. Text associated with this style is displayed in the rectangle's upper-left corner.
BS_OWNERDRAW Creates an owner-drawn button. The framework calls the DrawItem method when a visual aspect of the button has changed. This style must be set when you use the CBitmapButton class.
BS_PUSHBUTTON Creates a command button that sends a BN_CLICKED notification to the owner window when the user clicks the button.
BS_RADIOBUTTON Creates a radio button with two states: BST_CHECKED and BST_UNCHECKED. Radio buttons are usually used in groups, with each group having a maximum of one checked option at a time. Clicking on the button sends a BN_CLICKED notification to the owner window but does not automatically change the state of any button in the group. By default, associated text is displayed to the right of the radio button. To display text to the left of the radio button, use the BS_LEFTTEXT or BS_RIGHTBUTTON style.
BS_SPLITBUTTON Creates a split button. A split button is a command button specific to Windows Vista that contains a button adjacent to a drop-down arrow. When you click the button, the default command is executed. When you click the drop-down arrow, a menu of additional commands appears.
BS_USERBUTTON Obsolete, but provided for compatibility with 16-bit versions of Windows. Win32-based applications should use BS_OWNERDRAW instead.

Radio button and check box styles

The following table lists styles that are specific to radio buttons and check boxes. These styles are ignored in all other button types. You can optionally choose one or more of the following.

Style Description
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_RIGHTBUTTON When combined with a radio button or check-box style, the text appears on the left side of the radio button or check box. This style is identical to the BS_LEFTTEXT style.
BS_PUSHLIKE Makes a check box or radio button look and behave like a command button. The button appears pressed when its state is BST_CHECKED, pressed and dimmed when its state is BST_INDETERMINATE, and released when its state is BST_UNCHECKED.

Button text alignment styles

The following table lists horizontal and vertical text alignment options. You can optionally choose one of the following.

Style Description
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_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_CENTER Centers text horizontally in the button rectangle.
BS_TOP Places text at the top of the button rectangle.
BS_BOTTOM Places text at the bottom of the button rectangle.
BS_VCENTER Centers text vertically in the button rectangle.

Button content options

The following table lists options that indicate what is displayed in the button. Button types that only display text ignore these styles. You can optionally choose one of the following.

Style Description
BS_BITMAP Specifies that the button displays a bitmap.
BS_ICON Specifies that the button displays an icon.
BS_TEXT Specifies that the button displays text.

Other button options

The following table lists additional options that you can use with any button type. You can optionally choose one or more of the following.

Style Description
BS_FLAT Specifies that the button is two-dimensional and is not drawn with default shading to create a three-dimensional image.
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 regardless of whether this style is specified.

Combo-box styles

The following combo-box styles are available in MFC. For more information about combo-box styles in Windows, see Combo Box Styles (Windows).

Style Description
CBS_AUTOHSCROLL Automatically scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.
CBS_DISABLENOSCROLL The list box shows a disabled vertical scroll bar when the list box does not contain enough items to scroll. Without this style, the scroll bar is hidden when the list box does not contain enough items.
CBS_DROPDOWN Similar to CBS_SIMPLE, except that the list box is not displayed unless the user selects an icon next to the edit control.
CBS_DROPDOWNLIST Similar to CBS_DROPDOWN, except that the edit control is replaced by a static-text item that displays the current selection in the list box.
CBS_HASSTRINGS An owner-draw combo box contains items consisting of strings. The combo box maintains the memory and pointers for the strings so the application can use the GetText member function to retrieve the text for a particular item.
CBS_LOWERCASE Converts to lowercase all text in both the selection field and the list.
CBS_NOINTEGRALHEIGHT Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, Windows sizes a combo box so that the combo box does not display partial items.
CBS_OEMCONVERT Text entered in the combo-box edit control is converted from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the AnsiToOem Windows function to convert an ANSI string in the combo box to OEM characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN styles.
CBS_OWNERDRAWFIXED The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.
CBS_OWNERDRAWVARIABLE The owner of the list box is responsible for drawing its contents; the items in the list box are variable in height.
CBS_SIMPLE The list box is displayed at all times. The current selection in the list box is displayed in the edit control.
CBS_SORT Automatically sorts strings entered into the list box.
CBS_UPPERCASE Converts to uppercase all text in both the selection field and the list.

Edit styles

Edit styles apply to CEdit Class objects. Specify a combination of styles in the dwStyle parameter of CEdit::Create. For more information about edit control styles in Windows, see Edit Control Styles (Windows).

Style Description
ES_AUTOHSCROLL Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position 0.
ES_AUTOVSCROLL Automatically scrolls text up one page when the user presses ENTER on the last line.
ES_CENTER Centers text in a single-line or multiline edit control.
ES_LEFT Left-aligns text in a single-line or multiline edit control.
ES_LOWERCASE Converts all characters to lowercase as they are typed into the edit control.
ES_MULTILINE Designates a multiple-line edit control. (The default is single line.) If the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If ES_AUTOVSCROLL is not given, the edit control shows as many lines as possible and beeps if ENTER is pressed when no more lines can be displayed. If the ES_AUTOHSCROLL style is specified, the multiple-line edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press ENTER. If ES_AUTOHSCROLL is not given, the control automatically wraps words to the beginning of the next line when necessary; a new line is also started if ENTER is pressed. The position of the wordwrap is determined by the window size. If the window size changes, the wordwrap position changes and the text is redisplayed. Multiple-line edit controls can have scroll bars. An edit control with scroll bars processes its own scroll-bar messages. Edit controls without scroll bars scroll as described above and process any scroll messages sent by the parent window.
ES_NOHIDESEL Normally, an edit control hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. Specifying ES_NOHIDESEL deletes this default action.
ES_NUMBER Allows only digits to be entered into the edit control.
ES_OEMCONVERT Text entered in the edit control is converted from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the AnsiToOem Windows function to convert an ANSI string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.
ES_PASSWORD Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the SetPasswordChar member function to change the character that is displayed.
ES_READONLY Prevents the user from entering or editing text in the edit control.
ES_RIGHT Right-aligns text in a single-line or multiline edit control.
ES_UPPERCASE Converts all characters to uppercase as they are typed into the edit control.
ES_WANTRETURN Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiple-line edit control in a dialog box. Without this style, pressing the ENTER key has the same effect as pressing the dialog box's default pushbutton. This style has no effect on a single-line edit control.

Frame-window styles

Frame-window styles apply to CFrameWnd Class objects. Specify a combination of styles in the dwStyle parameter of CFrameWnd::Create.

Style Description
FWS_ADDTOTITLE Specifies information to append to the end of a frame window title. For example, "Microsoft Draw - Drawing in Document1". You can specify the strings displayed in the Document Template Strings tab in the Application Wizard. If you need to turn this option off, override the CWnd::PreCreateWindow member function.
FWS_PREFIXTITLE Shows the document name before the application name in a frame window title. For example, "Document - WordPad". You can specify the strings displayed in the Document Template Strings tab in the Application Wizard. If you need to turn this option off, override the CWnd::PreCreateWindow member function.
FWS_SNAPTOBARS Controls sizing of the frame window that encloses a control bar when it is in a floating window rather than docked to a frame window. This style sizes the window to fit the control bar.

List-box styles

List-box styles apply to CListBox Class objects. Specify a combination of styles in the dwStyle parameter of CListBox::Create. For more information about list box styles in Windows, see List Box Styles (Windows).

Style Description
LBS_DISABLENOSCROLL The list box shows a disabled vertical scroll bar when the list box does not contain enough items to scroll. Without this style, the scroll bar is hidden when the list box does not contain enough items.
LBS_EXTENDEDSEL The user can select multiple items using the SHIFT key and the mouse or special key combinations.
LBS_HASSTRINGS Specifies an owner-draw list box that contains items consisting of strings. The list box maintains the memory and pointers for the strings so the application can use the GetText member function to retrieve the text for a particular item.
LBS_MULTICOLUMN Specifies a multicolumn list box that is scrolled horizontally. The SetColumnWidth member function sets the width of the columns.
LBS_MULTIPLESEL String selection is toggled each time the user clicks or double-clicks the string. Any number of strings can be selected.
LBS_NODATA Specifies a no-data list box. Specify this style when the count of items in the list box will exceed one thousand. A no-data list box must also have the LBS_OWNERDRAWFIXED style, but must not have the LBS_SORT or LBS_HASSTRINGS style.

A no-data list box resembles an owner-drawn list box except that it contains no string or bitmap data for an item. Commands to add, insert, or delete an item always ignore any given item data; requests to find a string within the list box always fail. The system sends the WM_DRAWITEM message to the owner window when an item must be drawn. The itemID member of the DRAWITEMSTRUCT structure passed with the WM_DRAWITEM message specifies the line number of the item to be drawn. A no-data list box does not send a WM_DELETEITEM message.
LBS_NOINTEGRALHEIGHT The size of the list box is exactly the size specified by the application when it created the list box. Usually, Windows sizes a list box so that the list box does not display partial items.
LBS_NOREDRAW List-box display is not updated when changes are made. This style can be changed at any time by sending a WM_SETREDRAW message.
LBS_NOSEL Specifies that the list box contains items that can be viewed but not selected.
LBS_NOTIFY Parent window receives an input message whenever the user clicks or double-clicks a string.
LBS_OWNERDRAWFIXED The owner of the list box is responsible for drawing its contents; the items in the list box are the same height.
LBS_OWNERDRAWVARIABLE The owner of the list box is responsible for drawing its contents; the items in the list box are variable in height.
LBS_SORT Strings in the list box are sorted alphabetically.
LBS_STANDARD Strings in the list box are sorted alphabetically, and the parent window receives an input message whenever the user clicks or double-clicks a string. The list box contains borders on all sides.
LBS_USETABSTOPS Allows a list box to recognize and expand tab characters when drawing its strings. The default tab positions are 32 dialog units. (A dialog unit is a horizontal or vertical distance. One horizontal dialog unit is equal to one-fourth of the current dialog base width unit. The dialog base units are computed based on the height and width of the current system font. The GetDialogBaseUnits Windows function returns the current dialog base units in pixels.) This style should not be used with LBS_OWNERDRAWFIXED.
LBS_WANTKEYBOARDINPUT The owner of the list box receives WM_VKEYTOITEM or WM_CHARTOITEM messages whenever the user presses a key while the list box has input focus. This allows an application to perform special processing on the keyboard input.

Message-box styles

Message-box styles apply to AfxMessageBox items. Specify a combination of styles in the nType parameter of AfxMessageBox. For more information about message box styles in Windows, see MessageBox Function (Windows).

The following message-box styles are available.

Message-box types

Style Description
MB_ABORTRETRYIGNORE The message box contains three pushbuttons: Abort, Retry, and Ignore.
MB_OK The message box contains one pushbutton: OK.
MB_OKCANCEL The message box contains two pushbuttons: OK and Cancel.
MB_RETRYCANCEL The message box contains two pushbuttons: Retry and Cancel.
MB_YESNO The message box contains two pushbuttons: Yes and No.
MB_YESNOCANCEL The message box contains three pushbuttons: Yes, No, and Cancel.

Message-box modality

Style Description
MB_APPLMODAL The user must respond to the message box before continuing work in the current window. However, the user can move to the windows of other applications and work in those windows. The default is MB_APPLMODAL if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
MB_SYSTEMMODAL All applications are suspended until the user responds to the message box. System-modal message boxes are used to notify the user of serious, potentially damaging errors that require immediate attention and should be used sparingly.
MB_TASKMODAL Similar to MB_APPLMODAL, but not useful within a Microsoft Foundation class application. This flag is reserved for a calling application or library that does not have a window handle available.

Message-box icons

Style Description
MB_ICONEXCLAMATION An exclamation-point icon appears in the message box.
MB_ICONINFORMATION An icon consisting of an "I" in a circle appears in the message box.
MB_ICONQUESTION A question-mark icon appears in the message box.
MB_ICONSTOP A stop-sign icon appears in the message box.

Message-box default buttons

Style Description
MB_DEFBUTTON1 The first button is the default. Note that the first button is always the default unless MB_DEFBUTTON2 or MB_DEFBUTTON3 is specified.
MB_DEFBUTTON2 The second button is the default.
MB_DEFBUTTON3 The third button is the default.

Scroll-bar styles

Scroll-bar styles apply to CScrollBar Class objects. Specify a combination of styles in the dwStyle parameter of CScrollBar::Create. For more information about scroll bar control styles in Windows, see Scroll Bar Control Styles (Windows).

Style Description
SBS_BOTTOMALIGN Used with the SBS_HORZ style. The bottom edge of the scroll bar is aligned with the bottom edge of the rectangle specified in the Create member function. The scroll bar has the default height for system scroll bars.
SBS_HORZ Designates a horizontal scroll bar. If neither the SBS_BOTTOMALIGN nor SBS_TOPALIGN style is specified, the scroll bar has the height, width, and position given in the Create member function.
SBS_LEFTALIGN Used with the SBS_VERT style. The left edge of the scroll bar is aligned with the left edge of the rectangle specified in the Create member function. The scroll bar has the default width for system scroll bars.
SBS_RIGHTALIGN Used with the SBS_VERT style. The right edge of the scroll bar is aligned with the right edge of the rectangle specified in the Create member function. The scroll bar has the default width for system scroll bars.
SBS_SIZEBOX Designates a size box. If neither the SBS_SIZEBOXBOTTOMRIGHTALIGN nor SBS_SIZEBOXTOPLEFTALIGN style is specified, the size box has the height, width, and position given in the Create member function.
SBS_SIZEBOXBOTTOMRIGHTALIGN Used with the SBS_SIZEBOX style. The lower-right corner of the size box is aligned with the lower-right corner of the rectangle specified in the Create member function. The size box has the default size for system size boxes.
SBS_SIZEBOXTOPLEFTALIGN Used with the SBS_SIZEBOX style. The upper-left corner of the size box is aligned with the upper-left corner of the rectangle specified in the Create member function. The size box has the default size for system size boxes.
SBS_SIZEGRIP Same as SBS_SIZEBOX, but with a raised edge.
SBS_TOPALIGN Used with the SBS_HORZ style. The top edge of the scroll bar is aligned with the top edge of the rectangle specified in the Create member function. The scroll bar has the default height for system scroll bars.
SBS_VERT Designates a vertical scroll bar. If neither the SBS_RIGHTALIGN nor SBS_LEFTALIGN style is specified, the scroll bar has the height, width, and position given in the Create member function.

Static styles

Static styles apply to CStatic Class objects. Specify a combination of styles in the dwStyle parameter of CStatic::Create. For more information about static control styles in Windows, see Static Control Styles (Windows).

Style Description
SS_BITMAP Specifies a bitmap is to be displayed in the static control. The given text is the name of a bitmap (not a filename) defined elsewhere in the resource file. The style ignores the nWidth and nHeight parameters; the control automatically sizes itself to accommodate the bitmap.
SS_BLACKFRAME Specifies a box with a frame drawn with the same color as window frames. The default is black.
SS_BLACKRECT Specifies a rectangle filled with the color used to draw window frames. The default is black.
SS_CENTER Designates a simple rectangle and displays the given text centered in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next centered line.
SS_CENTERIMAGE Specifies that, if the bitmap or icon is smaller than the client area of the static control, the rest of the client area is filled with the color of the pixel in the top left corner of the bitmap or icon. If the static control contains a single line of text, the text is centered vertically in the client area of the control.
SS_ENDELLIPSIS or SS_PATHELLIPSIS Replaces part of the given string with ellipsis, if necessary, so that the result fits in the specified rectangle.

You can specify SS_END_ELLIPSIS to replace characters at the end of the string, or SS_PATHELLIPSIS to replace characters in the middle of the string. If the string contains backslash (\) characters, SS_PATHELLIPSIS preserves as much of the text after the last backslash as possible.
SS_ENHMETAFILE Specifies an enhanced metafile is to be displayed in the static control. The given text is the name of a metafile. An enhanced metafile static control has a fixed size; the metafile is scaled to fit the static control's client area.
SS_ETCHEDFRAME Draws the frame of the static control using the EDGE_ETCHED edge style.
SS_ETCHEDHORZ Draws the top and bottom edges of the static control using the EDGE_ETCHED edge style.
SS_ETCHEDVERT Draws the left and right edges of the static control using the EDGE_ETCHED edge style.
SS_GRAYFRAME Specifies a box with a frame drawn with the same color as the screen background (desktop). The default is gray.
SS_GRAYRECT Specifies a rectangle filled with the color used to fill the screen background. The default is gray.
SS_ICON Designates an icon displayed in the dialog box. The given text is the name of an icon (not a filename) defined elsewhere in the resource file. The nWidth and nHeight parameters are ignored; the icon automatically sizes itself.
SS_LEFT Designates a simple rectangle and displays the given text flush-left in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next flush-left line.
SS_LEFTNOWORDWRAP Designates a simple rectangle and displays the given text flush-left in the rectangle. Tabs are expanded, but words are not wrapped. Text that extends past the end of a line is clipped.
SS_NOPREFIX Unless this style is specified, Windows will interpret any ampersand (&) characters in the control's text to be accelerator prefix characters. In this case, the ampersand is removed and the next character in the string is underlined. If a static control is to contain text where this feature is not wanted, SS_NOPREFIX may be added. This static-control style may be included with any of the defined static controls. You can combine SS_NOPREFIX with other styles by using the bitwise OR operator. This is most often used when filenames or other strings that may contain an ampersand need to be displayed in a static control in a dialog box.
SS_NOTIFY Sends the parent window STN_CLICKED, STN_DBLCLK, STN_DISABLE, and STN_ENABLE notification messages when the user clicks or double-clicks the control.
SS_OWNERDRAW Specifies that the owner of the static control is responsible for drawing the control. The owner window receives a WM_DRAWITEM message whenever the control needs to be drawn.
SS_REALSIZEIMAGE Prevents a static icon or bitmap control (that is, static controls that have the SS_ICON or SS_BITMAP style) from being resized as it is loaded or drawn. If the icon or bitmap is larger than the destination area, the image is clipped.
SS_RIGHT Designates a simple rectangle and displays the given text flush-right in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next flush-right line.
SS_RIGHTJUST Specifies that the lower right corner of a static control with the SS_BITMAP or SS_ICON style is to remain fixed when the control is resized. Only the top and left sides are adjusted to accommodate a new bitmap or icon.
SS_SIMPLE Designates a simple rectangle and displays a single line of text flush-left in the rectangle. The line of text cannot be shortened or altered in any way. (The control's parent window or dialog box must not process the WM_CTLCOLOR message.)
SS_SUNKEN Draws a half-sunken border around a static control.
SS_USERITEM Specifies a user-defined item.
SS_WHITEFRAME Specifies a box with a frame drawn with the same color as the window background. The default is white.
SS_WHITERECT Specifies a rectangle filled with the color used to fill the window background. The default is white.
SS_WORDELLIPSIS Truncates text that does not fit and adds ellipsis.

Window styles

Window styles apply to CWnd Class objects. Specify a combination of styles in the dwStyle parameter of CWnd::Create or CWnd::CreateEx. For more information about window styles in Windows, see Window Styles (Windows).

Style Description
WS_BORDER Creates a window that has a border.
WS_CAPTION Creates a window that has a title bar (implies the WS_BORDER style). Cannot be used with the WS_DLGFRAME style.
WS_CHILD Creates a child window. Cannot be used with the WS_POPUP style.
WS_CHILDWINDOW Same as the WS_CHILD style.
WS_CLIPCHILDREN Excludes the area occupied by child windows when you draw within the parent window. Used when you create the parent window.
WS_CLIPSIBLINGS Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only.
WS_DISABLED Creates a window that is initially disabled.
WS_DLGFRAME Creates a window with a double border but no title.
WS_GROUP Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP style FALSE after the first control belong to the same group. The next control with the WS_GROUP style starts the next group (that is, one group ends where the next begins).
WS_HSCROLL Creates a window that has a horizontal scroll bar.
WS_ICONIC Creates a window that is initially minimized. Same as the WS_MINIMIZE style.
WS_MAXIMIZE Creates a window of maximum size.
WS_MAXIMIZEBOX Creates a window that has a Maximize button.
WS_MINIMIZE Creates a window that is initially minimized. For use with the WS_OVERLAPPED style only.
WS_MINIMIZEBOX Creates a window that has a Minimize button.
WS_OVERLAPPED Creates an overlapped window. An overlapped window usually has a caption and a border.
WS_OVERLAPPEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.
WS_POPUP Creates a pop-up window. Cannot be used with the WS_CHILD style.
WS_POPUPWINDOW Creates a pop-up window with the WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the Control menu visible.
WS_SIZEBOX Creates a window that has a sizing border. Same as the WS_THICKFRAME style.
WS_SYSMENU Creates a window that has a Control-menu box in its title bar. Used only for windows with title bars.
WS_TABSTOP Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style.
WS_THICKFRAME Creates a window with a thick frame that can be used to size the window.
WS_TILED Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style.
WS_TILEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.
WS_VISIBLE Creates a window that is initially visible.
WS_VSCROLL Creates a window that has a vertical scroll bar.

Extended window styles

Extended window styles apply to CWnd Class objects. Specify a combination of styles in the dwExStyle parameter of CWnd::CreateEx. For more information about extended window styles in Windows, see Extended Window Styles (Windows).

Style Description
WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files.
WS_EX_APPWINDOW Forces a top-level window onto the taskbar when the window is visible.
WS_EX_CLIENTEDGE Specifies that a window has a 3D look — that is, a border with a sunken edge.
WS_EX_CONTEXTHELP Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message.
WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key.
WS_EX_DLGMODALFRAME Designates a window with a double border that may (optionally) be created with a title bar when you specify the WS_CAPTION style flag in the dwStyle parameter.
WS_EX_LAYERED The window is a layered window. This style cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC. However, Microsoft Windows 8 does support the WS_EX_LAYERED style for child windows, where previous Windows versions support it only for top-level windows.
WS_EX_LEFT Gives window generic left-aligned properties. This is the default.
WS_EX_LEFTSCROLLBAR Places a vertical scroll bar to the left of the client area.
WS_EX_LTRREADING Displays the window text using left-to-right reading order properties. This is the default.
WS_EX_MDICHILD Creates an MDI child window.
WS_EX_NOPARENTNOTIFY Specifies that a child window created with this style will not send the WM_PARENTNOTIFY message to its parent window when the child window is created or destroyed.
WS_EX_OVERLAPPEDWINDOW Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles
WS_EX_PALETTEWINDOW Combines the WS_EX_WINDOWEDGE and WS_EX_TOPMOST styles.
WS_EX_RIGHT Gives a window generic right-aligned properties. This depends on the window class.
WS_EX_RIGHTSCROLLBAR Places a vertical scroll bar (if present) to the right of the client area. This is the default.
WS_EX_RTLREADING Displays the window text using right-to-left reading order properties.
WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
WS_EX_TOOLWINDOW Creates a tool window, which is a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the task bar or in the window that appears when the user presses ALT+TAB.
WS_EX_TOPMOST Specifies that a window created with this style should be placed above all nontopmost windows and stay above them even when the window is deactivated. An application can use the SetWindowPos member function to add or remove this attribute.
WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.
WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.

See also

MFC Class Overview
CWnd::Create
CWnd::CreateEx
CEdit::Create
CScrollBar::Create
CStatic::Create
AfxMessageBox
CreateWindow
CreateWindowEx
Button Styles (Windows)
Combo Box Styles (Windows)
Edit Control Styles (Windows)
List Box Styles (Windows)
MessageBox Function (Windows)
Scroll Bar Control Styles (Windows)
Static Control Styles (Windows)
Window Styles (Windows)
Extended Window Styles (Windows)