hOldTargetBitmap=(HBITMAP)SelectObject(hTargetDC,hTargetBitmap);
SetStretchBltMode(hTargetDC,COLORONCOLOR); //设置模式
//将源位图数据拷贝到目标区域
StretchBlt(hTargetDC,0,0,lpbmi->bmiHeader.biWidth,lpbmi->bmiHeader.biHeight,hSourceDC,0,0,lpSrcDIB->bmiHeader.biWidth,lpSrcDIB->bmiHeader.biHeight,SRCCOPY);
SelectObject(hSourceDC,hOldSourceBitmap); //
SelectObject(hTargetDC,hOldTargetBitmap);
//释放资源
DeleteDC(hSourceDC); //删除句柄
DeleteDC(hTargetDC);
ReleaseDC(NULL,hDC); //
GdiFlush();
memcpy(DisplayData,lpTargetBits,dwTargetBitsSize); //将lpTargetBits数据拷贝到显示单元
DeleteObject(hTargetBitmap); //删除内存位图对象
DeleteObject(hSourceBitmap);
return true;
}
|