其他分享
首页 > 其他分享> > mfc 显示png

mfc 显示png

作者:互联网

  1. 设置图片控件类型位owner draw

  2. 在onpaint事件中重绘

CImage image;
//IDC_MainImg为图片控件ID
	CWnd* pWnd = GetDlgItem(IDC_MainImg);
	CDC* pDC = pWnd->GetDC();
	HDC hDC = pDC->m_hDC;
	CRect rect_frame;
	pWnd->GetClientRect(&rect_frame);
	image.Load("E:test.png");

	::SetStretchBltMode(hDC, HALFTONE);
	::SetBrushOrgEx(hDC, 0, 0, NULL);
	image.Draw(hDC, rect_frame);
	ReleaseDC(pDC);
	image.Destroy();

标签:显示,mfc,image,pWnd,hDC,rect,pDC,frame,png
来源: https://www.cnblogs.com/ives/p/15379777.html