19,468
社区成员
发帖
与我相关
我的任务
分享
CRect rect;//定义矩形类
CWnd *pWnd = GetDlgItem(ID_ShowPi2);//获取控件句柄
pWnd->GetClientRect(&rect); //获取句柄指向控件区域的大小
CDC *pDc = pWnd->GetDC();//获取picture的DC
//int win_w = rect.Width(), win_h = rect.Height();//获取窗口宽高
CImage imgae;
Mat temp;
resize(img, temp, Size(rect.Width(), rect.Height()));
MatToCImage(temp, imgae);
pDc->SetStretchBltMode(COLORONCOLOR);
imgae.Draw(pDc->m_hDC, 0, 0, rect.Width(), rect.Height(), 0, 0, rect.Width(), rect.Height());//画出图片
ReleaseDC(pDc);