HANDLE GetStockObject(nIndex)
This function retrieves a handle to one of the predefined stock pens, brushes, or fonts.
Parameter | Type/Description |
nIndex | int Specifies the type of stock object desired. It can be any one of the following values: | ||
Value | Meaning | ||
BLACK_BRUSH | Black brush | ||
DKGRAY_BRUSH | Dark gray brush | ||
GRAY_BRUSH | Gray brush | ||
HOLLOW_BRUSH | Hollow brush | ||
LTGRAY_BRUSH | Light gray brush | ||
NULL_BRUSH | Null brush | ||
WHITE_BRUSH | White brush | ||
BLACK_PEN | Black pen | ||
NULL_PEN | Null pen | ||
WHITE_PEN | White pen | ||
ANSI_FIXED_FONT | ANSI fixed system font | ||
ANSI_VAR_FONT | ANSI variable system font | ||
DEVICE_DEFAULT_FONT | Device-dependent font | ||
OEM_FIXED_FONT | OEM-dependent fixed font | ||
SYSTEM_FONT | The system font. By default, Windows uses the system font to draw menus, dialog-box controls, and other text. In Windows versions 3.0 and later, the system font is proportional width; earlier versions of Windows use a fixed-width system font. | ||
Parameter | Type/Description |
Value | Meaning | |
SYSTEM_FIXED_FONT | The fixed-width system font used in earlier versions of Windows. This stock object is available for compatibility purposes. | |
DEFAULT_PALETTE | Default color palette. This palette consists of the 20 static colors always present in the system palette for matching colors in the logical palettes of background windows. |
The return value identifies the desired logical object if the function is successful. Otherwise, it is NULL.
The DKGRAY_BRUSH, GRAY_BRUSH, and LTGRAY_BRUSH objects should not be used as background brushes or for any other purpose in a window whose class does not specify CS_HREDRAW and CS_VREDRAW styles. Using a gray stock brush in such windows can lead to misalignment of brush patterns after a window is moved or sized. Stock-brush origins cannot be adjusted (for more information, see the SetBrushOrg function, later in this chapter).