Static Control Styles
Windows Predefined Controls – Part 14
Volume - Windows User Interface
Forward: In this part of the series, we look at Static Control Styles.
By: Chrysanthus Date Published: 29 Aug 2012
Introduction
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.
Use of Styles
The appearances and external behavior of a control is determined by its styles. In this part of the series, we look at text static control styles. You can combine more than one style in the dwStyle argument of the CreateWindowEx function using the | operator. | means and/or at that position.
SS_BLACKFRAME: This style produces a box with a frame drawn in the same color as the window frames. This color is black in the default color scheme.
SS_BLACKRECT: This style produces a rectangle whose area is filled with the current window frame color. This color is black in the default color scheme.
SS_EDITCONTROL: This produces a static control that duplicates the text-displaying characteristics of a multi-line edit control.
SS_ENDELLIPSIS: If the end of text in the control does not fit in the rectangle (area), it is truncated and ellipses are added. If a word that is not at the end of the text goes beyond the limits of the rectangle, it is truncated without ellipses. Using this style will force the control string to be on one line with no word wrap. You can compare this with SS_PATHELLIPSIS and SS_WORDELLIPSIS.
SS_ETCHEDFRAME: This style draws the frame of the static control using a style known as the EDGE_ETCHED edge style.
SS_ETCHEDHORZ: This style draws the top and bottom edges of the static control using the EDGE_ETCHED edge style.
SS_ETCHEDVERT: This style draws the left and right edges of the static control using the EDGE_ETCHED edge style.
SS_GRAYFRAME: This style produces a box with a frame drawn with the same color as the screen background (desktop). This color is gray in the default color scheme.
SS_GRAYRECT: This produces a rectangle filled with the current screen background color. This color is gray in the default color scheme.
SS_NOPREFIX: This style prevents interpretation of any ampersand (&) characters in the control's text as accelerator prefix characters (see later). These are displayed with the ampersand removed and the next character in the text underlined. This style may be included with any of the defined static controls.
SS_NOTIFY: This style sends the parent window STN_CLICKED, STN_DBLCLK, STN_DISABLE, and STN_ENABLE notification codes when the user clicks or double-clicks the control.
SS_PATHELLIPSIS: This style replaces characters in the middle of the text with ellipses so that the result fits in the specified rectangle. If the text contains backslash () characters, the style preserves as much as possible of the text after the last backslash. Using this style will force the control’s text to be on one line with no word wrap. You can compare with SS_ENDELLIPSIS and SS_WORDELLIPSIS.
SS_SUNKEN: This style draws a half-sunken border around a static control.
SS_WHITEFRAME: The produces a box with a frame drawn with the same color as the window background. This color is white in the default color scheme.
SS_WHITERECT: This produces a rectangle (area) filled with the current window background color. This color is white in the default color scheme.
SS_WORDELLIPSIS: This style truncates any word that does not fit in the rectangle and adds ellipses. Using this style will force the control’s text to be on one line with no word wrap. You can compare with SS_ENDELLIPSIS and SS_PATHELLIPSIS.
SS_CENTER: This style produces a simple rectangle and centers the text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next centered line. Words that are longer than the width of the control are truncated.
SS_LEFT: This style produces a simple rectangle and left-aligns the text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next left-aligned line. Words that are longer than the width of the control are truncated.
SS_RIGHT: This style produces a simple rectangle and right-aligns the text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next right-aligned line. Words that are longer than the width of the control are truncated.
SS_SIMPLE: This style produces a simple rectangle and displays a single line of left-aligned text in the rectangle. The text line cannot be shortened or altered in any way. Also, if the control is disabled, the control does not gray its text.
SS_LEFTNOWORDWRAP: This produces a simple rectangle and left-aligns the text in the rectangle. Tabs (type at keyboard) are expanded, but words are not wrapped. Text that extends past the end of a line is clipped.
You should try each of the above constant identifiers, combining with WS_CHILD to see the effects on the screen
That is it for this part of the series. We stop here and continue in the next part.
Chrys
Related Courses
C++ CourseRelational Database and Sybase
Windows User Interface
Computer Programmer – A Jack of all Trade – Poem
NEXT