Selects a CGdiObject object that corresponds to one of the predefined stock pens, brushes, or fonts.

virtual CGdiObject* SelectStockObject(
   int nIndex 



Specifies the kind of stock object desired. It can be one of the following values:

  • 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.

  • SYSTEM_FIXED_FONT   The fixed-width system font used in Windows prior to version 3.0. This object is available for compatibility with earlier versions of Windows.

  • DEFAULT_PALETTE   Default color palette. This palette consists of the 20 static colors in the system palette.

A pointer to the CGdiObject object that was replaced if the function is successful. The actual object pointed to is a CPen, CBrush, or CFont object. If the call is unsuccessful, the return value is NULL.

Community Additions