-
设置图片控件类型位owner draw
-
在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();