MFC可以在加载图片的时候修改图片大小,我用的一个函数是:
HANDLE LoadImage( HINSTANCE hinst, // handle to instance LPCTSTR lpszName, // name or identifier of the image UINT uType, // image type int cxDesired, // desired width int cyDesired, // desired height UINT fuLoad // load options );为了方便期间,我把他配置成我需要的宏定义:
#define HBMP(filepath,width,height) (HBITMAP)LoadImage(AfxGetInstanceHandle(),filepath,IMAGE_BITMAP,width,height,LR_LOADFROMFILE|LR_CREATEDIBSECTION)使用的时候:
this->GetClientRect(&rect); rect.SetRect(rect.left,rect.top+50,rect.right,rect.top+150); p_picture = new CStatic; p_picture->Create("",WS_VISIBLE|SS_BITMAP,rect,this,IDC_STATIC_PICTURE); SwitchJpegToBmp(); HBITMAP h_bitmap = HBMP("./res/res.bmp",rect.right,50); p_picture->SetBitmap(h_bitmap);
MFC 如何修改BMP图片的大小,布布扣,bubuko.com
原文:http://blog.csdn.net/ieczw/article/details/20074585