CBitmap::CreateBitmap

Syntax

BOOL CreateBitmap( int nWidth, int nHeight, BYTE nPlanes, BYTE nBitcount, LPSTR lpBits );

Parameters

nWidth

Specifies the width (in pixels) of the bitmap.

nHeight

Specifies the height (in pixels) of the bitmap.

nPlanes

Specifies the number of color planes in the bitmap.

nBitcount

Specifies the number of color bits per display pixel.

lpBits

Points to a short-integer array that contains the initial bitmap bit values. If it is NULL, the new bitmap is left uninitialized. For more information, see the description of the bmBits field in the BITMAP structure in the Windows Software Development Kit documentation.

Remarks

Initializes a device-dependent memory bitmap that has the specified width, height, and bit pattern. Although a bitmap cannot be directly selected for a display device, it can be selected as the current bitmap for a memory device context by using CDC::SelectObject or CMetaFileDC::SelectObject and copied to any compatible device context by using the CDC::BitBlt function. When an application has finished using the bitmap created by the CreateBitmap function, it should select the bitmap out of the device context.

Return Value

TRUE if successful; otherwise FALSE.

See Also

CDC::SelectObject, CMetaFileDC::SelectObject, CDC::BitBlt, ::CreateBitmap