Rob
March 29th, 1999, 01:58 AM
Try sticking the following code in the OnDraw handler:
// Draw the background image
IPicture *pPic;
HBRUSH hBrush;
HPEN hPen, hPenOld;
HBITMAP hBmp, hBmpOld;
HDC hDC;
BOOL bBitBlt;
m_pPicture->QueryInterface(IID_IPicture, (void**)&pPic);
// Get the OLE picture object's handle
if(pPic){
pPic->get_Handle((OLE_HANDLE*)&hBmp);
pPic->Release();
pPic = NULL;
}
// Create a memory DC
hDC = CreateCompatibleDC(di.hdcDraw);
// Select the bitmap into the memory DC
hBmpOld = (HBITMAP)SelectObject(hDC, hBmp);
// Blt the bitmap from the memory dc to the screen
bBitBlt = BitBlt(di.hdcDraw,
di.prcBounds->left,
di.prcBounds->top,
di.prcBounds->right - di.prcBounds->left,
di.prcBounds->bottom - di.prcBounds->top,
hDC,
0,
0,
SRCCOPY);
// Select the old bitmap back into the memory DC
hBmp = (HBITMAP)SelectObject(hDC, hBmpOld);
// Delete the memory DC
DeleteDC(hDC);
// Draw the background image
IPicture *pPic;
HBRUSH hBrush;
HPEN hPen, hPenOld;
HBITMAP hBmp, hBmpOld;
HDC hDC;
BOOL bBitBlt;
m_pPicture->QueryInterface(IID_IPicture, (void**)&pPic);
// Get the OLE picture object's handle
if(pPic){
pPic->get_Handle((OLE_HANDLE*)&hBmp);
pPic->Release();
pPic = NULL;
}
// Create a memory DC
hDC = CreateCompatibleDC(di.hdcDraw);
// Select the bitmap into the memory DC
hBmpOld = (HBITMAP)SelectObject(hDC, hBmp);
// Blt the bitmap from the memory dc to the screen
bBitBlt = BitBlt(di.hdcDraw,
di.prcBounds->left,
di.prcBounds->top,
di.prcBounds->right - di.prcBounds->left,
di.prcBounds->bottom - di.prcBounds->top,
hDC,
0,
0,
SRCCOPY);
// Select the old bitmap back into the memory DC
hBmp = (HBITMAP)SelectObject(hDC, hBmpOld);
// Delete the memory DC
DeleteDC(hDC);