Class and Private Device Contexts
A
device context is a special set of values that applications use for drawing in the client
area of their windows. Windows requires a device context for each window on the
display but allows some flexibility in how the operating system stores and
treats that device context.
If no device-context style is explicitly given, Windows assumes each window
uses a device context retrieved from a pool of contexts maintained by Windows. In
such cases, each window must retrieve and initialize the device context before
painting and free it after painting.
To avoid retrieving a device context each time it needs to paint inside a
window, an application can specify the CS_OWNDC style for the window class. This
class style directs Windows to create a private device context
that is, to allocate a unique device context for each window in the class.
The application need only retrieve the context once and then use it for all
subsequent painting. Although the CS_OWNDC style is convenient, use it carefully,
because each device context uses a significant portion of system resources.
By specifying the CS_CLASSDC style, an application can create a class device
context. A class device context is a rarely used feature that allows multiple
windows created from the same window class within a process to use exactly the
same device context for drawing.
An application can specify the CS_PARENTDC style to set the clipping region of
the child window to that of the parent window so the child can draw in the
parent. A window with the CS_PARENTDC style receives a regular device context from
the system's cache of device contexts. It does not give a child window's
device context or device context settings to the parent window. Specifying
CS_PARENTDC enhances an application's performance because Windows doesn't need to keep
recalculating the visible region for each child window.
For more information, see
Device Contexts and
Painting and Drawing.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database