Opens a Styles dialog box for the currently selected control or dialog.
·To open a Styles dialog box:
Choose the Styles command from the Edit menu.
Or double-click a control or dialog.
Or press ENTER.
Dialog boxes can have the styles shown in the lists below.
The following options specify the memory status of the dialog resource.
Preload
Loads the dialog resource into memory as soon as the application is started. If this is not specified, the dialog resource will be loaded into memory only when needed.
Moveable
Allows Windows to move the dialog resource into memory as needed.
Discardable
Indicates that the dialog resource in memory can be discarded if necessary. The dialog resource will be reloaded from disk if it is needed later.
Pure
Tells Windows that the dialog resource contains no dynamic information. If Pure is not checked, Windows can't dispose of the dialog resource under low memory conditions.
Selects a font for the dialog and its controls. The combo box displays the fonts available on your system.
Selects a point size for the selected font. The combo box displays the sizes available for the font on your system.
Selects a class for the dialog. You must also register this class when your application creates the dialog. Leave blank to select the default dialog class.
The Frame Style determines what kind of frame the dialog has. The dialog can have one of the following:
Border
Creates a window that has a border.
Dialog
Creates a standard dialog box border.
Modal
Creates a dialog box with a modal frame that can be combined with a title bar and system menu.
Sizing (Thick)
Creates a standard sizing border that allows the dialog to be resized using the mouse.
The dialog frame can have any number of the following optional controls:
Caption
Gives the dialog box a title bar.
Min Button
Provides a minimize button, used for minimizing the dialog into an icon.
Max Button
Provides a maximize button, used for maximizing the dialog to fit the entire screen.
System Menu
Creates a dialog box that has a system menu in its title bar.
Vert. Scroll Bar
Provides a vertical scroll bar along the right edge of the dialog.
Horz. Scroll Bar
Provides a horizontal scroll bar along the bottom of the dialog.
The following additional styles are also available:
Popup
Creates a popup window.
Child
Creates a child window.
Clip Siblings
Clips child windows relative to each other. That is, when a particular child window receives a WM_PAINT message, this style clips all other top-level child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not set and child windows overlap, it is possible that drawing in the client area of a child window will result in drawing in the client area of a neighboring child window.
Clip Children
Excludes the area occupied by child windows when drawing is done within the parent window. Used when creating the parent window.
Local Edit
Specifies that edit controls in the dialog box will use memory in the application's data segment. By default, all edit controls in dialog boxes use memory outside the application's data segment.
Absolute Align
Causes the dialog's x, y origin to be relative to the screen.
System Modal
Creates a system-modal dialog box. No other window can become active until this dialog is closed.
No Idle Message
Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the owner of the dialog box while the dialog is displayed.
Visible
Causes the dialog to be visible initially.
Disabled
Causes the dialog to be unavailable for selection.
All of the controls have the choice of these basic styles described in the list below. Many controls have additional styles, which are described in the following lists.
Visible
Causes the control to be visible initially. If this style is not set, the control will be invisible initially.
Disabled
Causes the control to be unavailable for selection. A disabled control cannot be selected, and usually it is displayed in a grayed color.
Group
Causes a control to begin a new “group.” Controls in a group are usually positioned close together in a logical unit. Arrow keys will cause the focus to cycle through controls in a group in the order that they are defined in the dialog. Use the Order/Group dialog in the Arrange menu to change control order and to define groups.
Tabstop
Creates a tab stop for the control. When the user presses the TAB key, the focus will jump, in turn, to each stop. Some controls do not support tab stops.
The Text Styles dialog box changes the style of the currently selected text control.
The text can be horizontally aligned in one of the following ways:
Left
Aligns the text on the left.
Center
Centers the text horizontally.
Right
Aligns the text on the right.
The following style is also available:
No Prefix
Unless this style is specified, Windows will interpret any “&” characters in the control's text to be accelerator prefix characters. The “&” will be removed, and the next character underlined.
See also the basic styles that apply to all controls at the beginning of this section.
The Edit Field Styles dialog box changes the style of the currently selected Edit Field control.
The text can be aligned in one of the following ways:
Left
Aligns the text on the left.
Center
Centers the text horizontally.
Right
Aligns the text on the right.
The following styles are also available:
Border
Draws a border around the control.
Uppercase
Converts all characters to uppercase as they are typed.
Lowercase
Converts all characters to lowercase as they are typed.
Password
Displays all characters as asterisks (*) as they are typed.
No Hide Sel.
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. Setting this style overrides this default.
OEM Convert
Converts text entered in the combo box edit control 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 function to convert an ANSI string to OEM characters.
Auto HScroll
Scrolls text automatically to the right by 10 characters when the user types a character at the end of the line.
Multi-Line
Creates a multiple-line edit control.
Vert. Scroll
Gives multiple-line edit control a vertical scroll bar.
Auto VScroll
Scrolls text automatically up one page when the user presses the ENTER key on the last line.
Horz. Scroll
Gives multiple-line edit control a horizontal scroll bar.
See also the basic styles that apply to all controls at the beginning of this section.
See the basic styles that apply to all controls at the beginning of this section.
The Push Button Styles dialog box changes the style of the currently selected push button control.
The following style is available:
Default
Creates a button with a heavy black border. The user can select this button by pressing the ENTER key. Only one default push button is allowed in a dialog, so this style will not be available if another default push button is present in the current dialog.
See also the basic styles that apply to all controls at the beginning of this section.
The Check Box Styles dialog box changes the styles of the currently selected check box control.
The following styles are available:
Auto
Causes the check box to automatically check and uncheck itself when it is clicked by the mouse. If this style is not set, it is the application's responsibility to check and uncheck the box.
3 State
Allows a check box to have a third state in addition to its checked and unchecked states.
Left Text
Positions the text on the left of the check box rather than the right.
See also the basic styles that apply to all controls at the beginning of this section.
The Radio Button Styles dialog changes the style of the currently selected radio button control.
The following styles are available:
Auto
Causes the radio button to automatically select itself when it is clicked by the mouse. Otherwise, it is the application's responsibility to select the button.
Left Text
Causes the button's text to appear on the left rather than the right.
See also the basic styles that apply to all controls at the beginning of this section.
The Combo Box Styles dialog changes the style of the currently selected combo box control.
The following combo box types are available:
Simple
Makes the list box always visible. The user can select a string from the list box or type in the entry field.
Drop Down
Same as a simple combo box, except that the list box is initially collapsed into an icon next to the entry field and the icon must be clicked to drop the list.
Drop Down List
Same as the drop down combo box, except that the user can select a string from the list box but cannot type into the entry field.
Combo boxes also have the following styles:
Sort
Sorts strings entered into the list box.
Vert. Scroll Bar
Gives the combo box a vertical scroll bar.
Auto HScroll
Scrolls the text in the edit control when the user types a character at the end of the line. If this style is not set, text is restricted to the boundaries of the edit control.
OEM Convert
Converts text entered in the combo box edit control 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 function to convert an ANSI string to OEM characters.
No Integral Height
Creates a combo box that doesn't adjust to display an integral number of lines.
Owner-Draw Fixed
Creates a fixed-height owner-draw combo box. The owner of the box draws its contents, and the items in the box are all the same height.
Owner-Draw Variable
Creates a variable-height owner-draw combo box. The owner of the box draws its contents, and the items in the box can have different heights.
Has Strings
Maintains the memory and pointers for the combo box strings so that the application can use the LB_GETTEXT message to retrieve a string. Valid only for owner-draw combo boxes.
See also the basic styles that apply to all controls at the beginning of this section.
The List Box Styles dialog box changes the style of the currently selected list box control.
The following styles are available:
Standard
Includes Border, Sort, Notify, and Vert. Scroll Bar.
Border
Gives the list box a border.
Sort
Allows the list box to sort the strings alphabetically.
Notify
Gives the parent an input message whenever the user clicks or double-clicks a string.
Vert. Scroll Bar
Gives the list box a vertical scroll bar.
Horz. Scroll Bar
Gives the list box a horizontal scroll bar.
Use Tabstops
Gives the list box the ability to recognize and expand tab characters when drawing its strings. The default tabs are set at every 32 dialog units.
No Redraw
Prevents the list box display from being updated when changes are made.
No Integral Height
Makes the size of the box exactly the size specified in the Dialog Editor. Normally, Windows sizes a list box so that it doesn't display partial items.
Want Keyboard Input
The owner of the box receives a message, either WM_VKEYTOITEM or WM_CHARTOITEM, whenever the user presses a key and the box has the focus. The box owner can then perform special processing on the keyboard input.
Multi-Column
Gives the list box multiple columns and allows it to be scrolled horizontally.
Multiple Selection
Toggles the string selection each time the user selects it. The user can select any number of strings.
Extended Selection
Allows the user to select multiple items using the mouse with the SHIFT and/or CONTROL key, or special key combinations.
Owner-Draw Fixed
Creates a fixed-height owner-draw list box. The owner of the box draws its contents, and all items in the box are the same height.
Owner-Draw Variable
Creates a variable-height owner-draw list box. The owner of the box draws its contents, and the items in the box are variable height.
Has Strings
Maintains the memory and pointers for the list box strings so that the application can use the LB_GETTEXT message to retrieve a string. Only valid for owner-draw list boxes.
See also the basic styles that apply to all controls at the beginning of this section.
See the basic styles that apply to all controls at the beginning of this section.
See the basic styles that apply to all controls at the beginning of this section.
The Frame Styles dialog changes the style of the currently selected frame control.
The frame can be one of the following types:
Black
Makes the frame the same color as window frames. The default color is black.
Gray
Makes the frame the same color as the screen background on the desktop. The default color for the desktop is gray.
White
Makes the frame the same color as window backgrounds. The default color is white.
See also the basic styles that apply to all controls at the beginning of this section.
The Rectangle Styles dialog changes the style of the currently selected rectangle control.
The rectangle can be one of the following types:
Black
Makes the rectangle the same color as window frames. The default color is black.
Gray
Makes the rectangle the same color as the screen background on the desktop. The default color for the desktop is gray.
White
Makes the rectangle the same color as window backgrounds. The default color is white.
See also the basic styles that apply to all controls at the beginning of this section.
See the basic styles that apply to all controls at the beginning of this section.
In Windows, you can create unique and powerful custom controls that are specific to your application. If you haven't made a custom control before, first read “Custom Controls” on page 27.
After you place a custom control, double click on it to open its style dialog.
·To enter the new control's window class name:
Use the Class Name field in the style dialog.
For example, if you decide to call the new control class DragDrop, enter DragDrop in the field.
You are responsible for writing a window procedure for the custom control. This procedure will handle all messages to the control and will also interpret the control's style.
A control's style is contained in a “long” (a double word). The custom control style dialog lets you set any style bits you wish. You may decide, for example, to define styles for left justified, centered, or right justified text.
When Windows creates the control, it passes a WM_CREATE message to your window procedure, which includes the control's style. Your procedure will then be able to initialize the control according to the style settings.
At paint time, you can use style settings to determine how the control draws its text or its border.
The style long is displayed in hex format in the style field. For your convenience, four basic styles also appear in the custom control style dialog. If you click in a basic style check box, you'll notice that the style long is modified.
·To add further styles:
Enter their numeric equivalents in the style long.
For example, to set a style with a value of 0x10, change 0x50000000 to 0x50000010.