|
Window Background
The window background is the color or pattern used to fill the client area
before a window begins drawing. The window background covers whatever was on the
screen before the window was moved there, erasing existing images and preventing
the application's new output from being mixed with unrelated information.
Windows paints the background for a window or gives the window the opportunity
to do so by sending it a WM_ERASEBKGND message when the application calls BeginPaint. If an application does not process the message but passes it to DefWindowProc, Windows erases the background by filling it with the pattern in the
background brush specified by the window's class. If the brush is not valid or the
class has no background brush, Windows sets the fErase member in the PAINTSTRUCT structure BeginPaint returns, but carries out no other action. The application then has a second
chance to draw the window background, if necessary.
If it processes WM_ERASEBKGND, the application should use the message's wParam parameter to draw the background. This parameter contains the handle of the
display DC for the window. After drawing the background, the application should
return a nonzero value. This ensures that BeginPaint does not erroneously set the fErase member of the PAINTSTRUCT structure to a nonzero value (indicating the background should be erased)
when the application processes the subsequent WM_PAINT message.
An application can define a class background brush by assigning a brush handle
or a system color value to the hbrBackground member of the WNDCLASS structure when registering the class with the RegisterClass function. The GetStockObject or CreateSolidBrush function can be used to create a brush handle. A system color value can be
one of those defined for the SetSysColors function. (The value must be increased by one before it is assigned to the
member.)
An application can process the WM_ERASEBKGND message even though a class
background brush is defined. This is typical in applications that enable the user to
change the window background color or pattern for a given window without
affecting other windows in the class. In such cases, the application must not pass
the message to DefWindowProc.
It is not necessary for an application to align brushes, because the system
draws the brush using the window origin as the point of reference. Given this,
the user can move the window without affecting the alignment of pattern brushes.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|