MFC中的位图操作,涉及三个概念:CBitmap,HBitmap,BITMAP.

1.BITMAP是位图的基本数据结构,封装位图信息,包括颜色,大小,位值,数据等

typedef struct tagBITMAP
{ 
     int      bmType;
     int      bmWidth;   //宽
     int      bmHeight;  //高
     int      bmWidthBytes;
     BYTE     bmPlanes;
     BYTE     bmBitsPixel;
     LPVOID   bmBits;
}  BITMAP;

2.HBitmap是位图句柄,可以通过API函数LoadImage加载文件得到,LoadImage得到的句柄为通用类型即,HANDLE.需要转换成具体的资源类型后,才能给绘图CDC类实例使用,如:<