MFC 加载png图片

CImage img;
HRESULT ret = img.Load(_T("res/1.png")); //wuziqi.png是我要加载的图片名称,包含路径
HBITMAP hbitmap = img.Detach();


CBitmap cBitmap;
BITMAP bitmap;
CDC memdc;
cBitmap.Attach(hbitmap);
memdc.CreateCompatibleDC(pDC);
memdc.SelectObject(hbitmap);
cBitmap.GetBitmap(&bitmap);
pDC->StretchBlt(0,0,800,590,&memdc,0,0,800,590,SRCCOPY);

你可能感兴趣的:(C++面向对象编程)