Window Class Styles
Window Classes – Part 3
Forward: In this part of the series, we look at the window class styles.
By: Chrysanthus Date Published: 29 Aug 2012
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at firstname.lastname@example.org. That is, contact me for the slightest problem you have about what you are reading.
What is a Style
A Style defines how to update (re-present) the window after moving or resizing it, how to process double-clicks of the mouse, how to allocate space for the device context (see later), and other aspects of the window.
I will now give you the identifiers for the styles and their descriptions. Each identifier can be a value for the style member of the WNDCLASSEX struct. Here are the style identifiers and their descriptions.
CS_HREDRAW: With this style, the entire window will be re-drawn (re-display) if a movement or size adjustment (drag) changes the width of the client area.
CS_VREDRAW: With this style, the entire window will be re-drawn (re-display) if a movement or size adjustment (drag) changes the height of the client area.
CS_NOCLOSE: This class disables the Close item on the window menu (see details later).
CS_OWNDC: This style allocates a unique device context (a drawing feature) for each window in the class. See details later.
CS_BYTEALIGNCLIEN: This style aligns the window’s client area (in the x direction) to enhance performance during drawing operations. This style affects the width of the window and its horizontal position on the display.
CS_BYTEALIGNWINDOW: This style aligns a window (in the x direction) to enhance performance during operations that involve moving or sizing the window. This style affects the width of the window and its horizontal position on the display.
CS_DBLCLKS: This style sends a double-click message to the procedure of the window when the user double-clicks the mouse while the cursor is within a window of the class.
CS_GLOBALCLASS: This style indicates that the class is an application global class.
CS_DROPSHADOW: See later.
CS_CLASSDC: See later.
CS_PARENTDC: See later.
CS_SAVEBITS: This style saves as a bitmap (an image type) the portion of the screen image obscured (covered) by a window. Windows uses the saved bitmap to recreate the screen image when the window is removed.
You can have more than one of the above styles for the style element of the WNDCLASSEX struct. A very common value for the style element is:
wcx.style = CS_HREDRAW | CS_VREDRAW;
The two styles have been combined with the | operator. | means “and/or” at that position.
Let us stop here and continue in the next part of the series.
Related CoursesC++ Course
Relational Database and Sybase
Windows User Interface
Computer Programmer – A Jack of all Trade – Poem