在MFC中如何获得一个CBitmap的宽和高?

来源:百度知道 编辑:UC知道 时间:2024/05/18 09:04:25
HBITMAP hImage = (HBITMAP)::LoadImage(NULL, m_strFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
CBitmap bmpImage;
bmpImage.Attach(hImage);

我用如上方法建立一个CBitMap对象,现在想知道这张图片的宽和高,应当怎么做?

直接用:
BITMAP bmp;
bmpIamge.GetBitmap(&bmp);
int nWidth = bmp.bmWidth;
int nHeight = bmp.bmHeight;

BITMAP bmp;
bmpIamge.GetBitmap(&bmp);
int nWidth = bmp.bmWidth;
int nHeight = bmp.bmHeight;

BITMAP bmp;//获取位图信息
GetObject(hImage, sizeof(BITMAP), &bmp);

int nWidth = bmp.bmWidth;//位图宽
int nHeight = bmp.bmHeight;//位图高

魔老大,用getbitmap()也可以把?