15,979
社区成员
发帖
与我相关
我的任务
分享
void CScreenView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: 在此添加绘制代码
CDC MemDC; //首先定义一个显示设备对象
CRect rect;
GetClientRect(&rect);
MemDC.CreateCompatibleDC(pDC);
BITMAPINFO *lpbi=(BITMAPINFO *)src;
tagBITMAPINFOHEADER* info_header=(BITMAPINFOHEADER *)lpbi;
HBITMAP hBitmap = CreateDIBitmap(pDC->m_hDC,info_header,CBM_INIT,src+screen.BmpInfoSize,lpbi,DIB_RGB_COLORS);
SelectObject(MemDC,hBitmap);
pDC->StretchBlt(rect.left,rect.top,rect.Width(),rect.Height(),&MemDC,rect.left,rect.top,info_header->biWidth,info_header->biHeight,SRCCOPY);
// CloseHandle(hBitmap);
MemDC.DeleteDC();
}