CBitmap::CreateBitmap

BOOLCreateBitmap(intnWidth**,intnHeight,UINTnPlanes,UINTnBitcount,constvoid*lpBits);**

Return Value

Nonzero if successful; otherwise 0.

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.

Remarks

Initializes a device-dependent memory bitmap that has the specified width, height, and bit pattern.

For a color bitmap, either the nPlanes or nBitcount parameter should be set to 1. If both of these parameters are set to 1, CreateBitmap creates a monochrome bitmap.

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 and copied to any compatible device context by using the CDC::BitBlt function.

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

For more information, see the description of the bmBits field in the BITMAP structure. The BITMAP structure is described under the CBitmap::CreateBitmapIndirect member function.

CBitmap OverviewClass MembersHierarchy Chart

See Also   CDC::SelectObject, CGdiObject::DeleteObject, CDC::BitBlt,