CString m_strfile; /***你在文件选择对话框中选中的文件名***/
CRect r;
GetClientRect(&r);
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
"Bmp files(*.bmp)|*.bmp|",NULL);
if(dlg.DoModal ())
{
m_strfile=dlg.GetPathName ();
}
HBITMAP hbitmap=(HBITMAP)LoadImage(AfxGetInstanceHandle(),
m_strfile,
IMAGE_BITMAP,
r.Width()/2,
r.Height()/2,
LR_LOADFROMFILE);
m_Bmp.SetBitmap(hbitmap);
转载于:https://www.cnblogs.com/xiaopengblog/archive/2013/05/16/3081986.html