共用方式為


CBitmap Class

Encapsulates a Windows graphics device interface (GDI) bitmap and provides member functions to manipulate the bitmap.

class CBitmap : public CGdiObject

Members

Public Constructors

Name

Description

CBitmap::CBitmap

Constructs a CBitmap object.

Public Methods

Name

Description

CBitmap::CreateBitmap

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

CBitmap::CreateBitmapIndirect

Initializes the object with a bitmap with the width, height, and bit pattern (if one is specified) given in a BITMAP structure.

CBitmap::CreateCompatibleBitmap

Initializes the object with a bitmap so that it is compatible with a specified device.

CBitmap::CreateDiscardableBitmap

Initializes the object with a discardable bitmap that is compatible with a specified device.

CBitmap::FromHandle

Returns a pointer to a CBitmap object when given a handle to a Windows HBITMAP bitmap.

CBitmap::GetBitmap

Fills a BITMAP structure with information about the bitmap.

CBitmap::GetBitmapBits

Copies the bits of the specified bitmap into the specified buffer.

CBitmap::GetBitmapDimension

Returns the width and height of the bitmap. The height and width are assumed to have been set previously by the SetBitmapDimension member function.

CBitmap::LoadBitmap

Initializes the object by loading a named bitmap resource from the application's executable file and attaching the bitmap to the object.

CBitmap::LoadMappedBitmap

Loads a bitmap and maps colors to current system colors.

CBitmap::LoadOEMBitmap

Initializes the object by loading a predefined Windows bitmap and attaching the bitmap to the object.

CBitmap::SetBitmapBits

Sets the bits of a bitmap to the specified bit values.

CBitmap::SetBitmapDimension

Assigns a width and height to a bitmap in 0.1-millimeter units.

Public Operators

Name

Description

CBitmap::operator HBITMAP

Returns the Windows handle attached to the CBitmap object.

Remarks

To use a CBitmap object, construct the object, attach a bitmap handle to it with one of the initialization member functions, and then call the object's member functions.

For more information on using graphic objects like CBitmap, see Graphic Objects.

Inheritance Hierarchy

CObject

CGdiObject

CBitmap

Requirements

Header: afxwin.h

See Also

Reference

CGdiObject Class

Hierarchy Chart

Concepts

MFC Sample MDI