다음을 통해 공유


CBitmap::CreateBitmapIndirect

Initializes a bitmap that has the width, height, and bit pattern (if one is specified) given in the structure pointed to by lpBitmap.

BOOL CreateBitmapIndirect(
   LPBITMAP lpBitmap 
);

Parameters

  • lpBitmap
    Points to a BITMAP structure that contains information about the bitmap.

Return Value

Nonzero if successful; otherwise 0.

Remarks

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 or CDC::StretchBlt function. (The CDC::PatBlt function can copy the bitmap for the current brush directly to the display device context.)

If the BITMAP structure pointed to by the lpBitmap parameter has been filled in by using the GetObject function, the bits of the bitmap are not specified and the bitmap is uninitialized. To initialize the bitmap, an application can use a function such as CDC::BitBlt or SetDIBits to copy the bits from the bitmap identified by the first parameter of CGdiObject::GetObject to the bitmap created by CreateBitmapIndirect.

When you finish with the CBitmap object created with CreateBitmapIndirect 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

CDC::SelectObject

CDC::BitBlt

CGdiObject::DeleteObject

CGdiObject::GetObject

CreateBitmapIndirect

Other Resources

CBitmap Members