本文将内存图存成bmp图片格式并在picture控件中显示
CClientDC dc(this);
CDC dcMemory;
CDC* pDC = GetDlgItem(IDC_PICTURE)->GetDC();//显示图片的picture控件ID为IDC_PICTURE
dcMemory.CreateCompatibleDC(pDC);
// CBitmap对象,用于加载位图
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&dc, 1920, 1440);//内存图大小设为1920*1440
//将位图载入内存设备
CBitmap* pOldBitmap = dcMemory.SelectObject(&bitmap);
//设置静态控件窗口风格为位图居中显示
p->ModifyStyle(0xf, SS_BITMAP | SS_CENTERIMAGE);
//将图片设置到Picture控件上
p->SetBitmap(bitmap);
//获得Graphic