Microsoft KB Archive/66532

{|
 * width="100%"|

Use of NULL_PEN, NULL_BRUSH, and HOLLOW_BRUSH

 * }

Q66532

-

The information in this article applies to:


 * Microsoft Windows Software Development Kit (SDK) versions 3.1, 3.0
 * Microsoft Win32 Application Programming Interface (API), on platform(s):
 * the operating system: Microsoft Windows NT, versions 3.5, 3.51
 * Microsoft Windows 4.0
 * Microsoft Windows 95

-

GDI contains several &quot;NULL&quot; 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, &quot;NULL_&quot; 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.

Additional query words: 3.00 3.10 3.50 4.00 hollow win16sdk

Keywords :

Issue type :

Technology : kbAudDeveloper kbSDKSearch kbWin32sSearch kbWin32API kbWinSDKSearch