Partilhar via


CBitmap::CreateDiscardableBitmap

Initializes a discardable bitmap that is compatible with the device context identified by pDC.

BOOL CreateDiscardableBitmap(
   CDC* pDC,
   int nWidth,
   int nHeight 
);

Parameters

  • pDC
    Specifies a device context.

  • nWidth
    Specifies the width (in bits) of the bitmap.

  • nHeight
    Specifies the height (in bits) of the bitmap.

Return Value

Nonzero if successful; otherwise 0.

Remarks

The bitmap has the same number of color planes or the same bits-per-pixel format as the specified device context. An application can select this bitmap as the current bitmap for a memory device that is compatible with the one specified by pDC.

Windows can discard a bitmap created by this function only if an application has not selected it into a display context. If Windows discards the bitmap when it is not selected and the application later attempts to select it, the CDC::SelectObject function will return NULL.

When you finish with the CBitmap object created with the CreateDiscardableBitmap function, first select the bitmap out of the device context, then delete the CBitmap object.

Requirements

Header: afxwin.h

See Also

Reference

CBitmap Class

Hierarchy Chart

CreateDiscardableBitmap

CGdiObject::DeleteObject

Other Resources

CBitmap Members