CRect rect;//define the rectangle class
The CWnd * pWnd=GetDlgItem (ID_ShowPi2);//access control handle
PWnd - & gt; GetClientRect (& amp; The rect);//get a handle to the size of the control area
The CDC * pDc=pWnd - & gt; GetDC ();//picture for DC
//int win_w=the rect. Width (), win_h=the rect. Height ();//get window wide high
CImage imgae;
Mat temp.
The resize (img, temp, the Size (the rect. Width (), the rect. Height ()));
MatToCImage (temp, imgae);
PDc - & gt; SetStretchBltMode (COLORONCOLOR);
Imgae. The Draw (pDc - & gt; M_hDC, 0, 0, the rect. Width () of the rect. Height (), 0, 0, the rect. The Width (), the rect. Height ());//draw a picture
The ReleaseDC (pDc);
This code can only display color images to show the single channel image,