Use of NULL_PEN, NULL_BRUSH, and HOLLOW_BRUSH (66532)
The information in this article applies to:
- Microsoft Windows Software Development Kit (SDK) 3.1
- Microsoft Windows Software Development Kit (SDK) 3.0
- Microsoft Win32 Application Programming Interface (API), when used with:
- the operating system: Microsoft Windows NT 3.5
- the operating system: Microsoft Windows NT 3.51
This article was previously published under Q66532
GDI contains several "NULL" stock objects: NULL_BRUSH, HOLLOW_BRUSH, and
NULL_PEN. These objects are defined in WINDOWS.H (16-bit SDK) or in
WINGDI.H (32-bit SDK). These header files define HOLLOW_BRUSH as
NULL_BRUSH, so they are the same objects.
Note that NULL_BRUSH and NULL_PEN are NOT identical to the value NULL. The
value NULL is defined as 0 (zero) in WINDOWS.H and is not a valid stock
object.
Many GDI functions use the current brush to fill interiors and the current
pen to draw lines. In some cases, an application may not want to modify the
areas normally affected by the pen or brush. Selecting a NULL_PEN or
NULL_BRUSH into the device context tells GDI not to modify the normally
affected areas. In short, "NULL_" objects do not draw anything.
For example, the Rectangle() function uses the current brush to fill
the interior of the rectangle and the current pen to draw the border.
If NULL_PEN is selected into the device context, no border is drawn.
If NULL_BRUSH or HOLLOW_BRUSH is selected, the interior of the
rectangle is not painted. If both NULL_PEN and NULL_BRUSH are
selected, the rectangle will not be drawn.
Modification Type: | Major | Last Reviewed: | 4/13/2004 |
---|
Keywords: | KB66532 |
---|
|