程序怎么使用png图片????
如题!!!!!!!!!!!!!!!!!1
[最优解释]
包含头文件:#include <atlimage.h>
定义成员变量 CImage image;
在OnInitDialog()或OnInitUpdate()函数里面:
char path[256];
GetCurrentDirectory(256,path);
CString filepath = path;
filepath += "\\res\\19.JPG";//加载图片的路径
image.Load(filepath);
在OnDraw()或OnPaint()函数里面:
HBITMAP hBitmap=image.Detach();
CBitmap bmp;
bmp.Attach(hBitmap);
CMainFrame* pframe = (CMainFrame*)AfxGetApp()->m_pMainWnd;
CImgTestView* pview = (CImgTestView*)pframe->GetActiveView();
CDC* pdc = pview->GetDC();
CDC memdc;
memdc.CreateCompatibleDC(pdc);
memdc.SelectObject(&bmp);
pdc->BitBlt(0,0,3000,3000,&memdc,0,0,SRCCOPY);
memdc.DeleteDC();
bmp.DeleteObject();
齐活儿
[其他解释]
Graphics graphics(GetDC()-> m_hDC);
Image image(L"Your.png", FALSE);
graphics.DrawImage(&image, 10,10, 100, 100);//大小位置
[其他解释]
http://download.csdn.net/detail/haha_12345_haha/3275486
[其他解释]
VC 贴png 图片的多种方http://download.csdn.net/detail/chudesong/3756838#comment法
[其他解释]
CImage
[其他解释]