8.4.2 Static Controls

A static control is a small window that contains text or graphics. You typically use a static control to label some other control or to create boxes and lines that separate one group of controls from another.

The most commonly used static control is the SS_LEFT style—a left-aligned line of text. That is, the control writes the line's text starting at the left end of the control, displaying as much of the label as will fit in the control and clipping the rest. The control uses the system font for the text, so you can calculate an appropriate size for the control by retrieving the font metrics for this font. For more information about fonts and font metrics, see Chapter 18, “Fonts.”

Like group boxes, static controls do not respond to user input; that is, they do not generate notification messages. However, you can change the appearance and location of a static control at any time. For example, you can change the text associated with a static control by using the SetWindowText function or the WM_SETTEXT message.