CGdiObject::CreateStockObject

Retrieves a handle to one of the predefined stock Windows GDI pens, brushes, or fonts, and attaches the GDI object to the CGdiObject object.

BOOL CreateStockObject(
   int nIndex 
);

Parameters

  • nIndex
    A constant specifying the type of stock object desired. See the parameter fnObject for GetStockObject in the Windows SDK for a description of appropriate values.

Return Value

Nonzero if the function is successful; otherwise 0.

Remarks

Call this function with one of the derived classes that corresponds to the Windows GDI object type, such as CPen for a stock pen.

Requirements

Header: afxwin.h

See Also

Concepts

CGdiObject Class

CGdiObject Members

Hierarchy Chart

CPen::CPen

CBrush::CBrush

CFont::CFont

CPalette::CPalette