if your app is view based then in the view
void CTest01View::OnDraw(CDC* pDC)
{
CTest01Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rc;
GetClientRect (rc);
// Get a DC for the bitmap
CDC dcImage;
dcImage.CreateCompatibleDC (pDC);
CBitmap *pOldBitmap = dcImage.SelectObject (&m_bkground);
// Draw the bitmap as the window background
pDC->BitBlt (0, 0, rc.Width(), rc.Height(), &dcImage, 0, 0, SRCCOPY);
// Release
dcImage.SelectObject (pOldBitmap);
dcImage.DeleteDC ();
// TODO: add draw code for native data here
}
where m_bkground is a CBitmap loaded from the resources...
e.g. m_bkground.LoadBitmap(IDB_BITMAP1); do this in the constructor...
if your app is dialog based do this instead...add the function...
BOOL CSkinnedDlg::OnEraseBkgnd (CDC *pDC)
{
CRect rc;
GetClientRect (rc);
// Get a DC for the bitmap
CDC dcImage;
dcImage.CreateCompatibleDC (pDC);
CBitmap *pOldBitmap = dcImage.SelectObject (&m_bkground);
// Draw the bitmap as the window background
pDC->BitBlt (0, 0, rc.Width(), rc.Height(), &dcImage, 0, 0, SRCCOPY);
// Release
dcImage.SelectObject (pOldBitmap);
dcImage.DeleteDC ();
// Return value: Nonzero if it erases the background.
return TRUE;
}
in the *.h file add
afx_msg BOOL OnEraseBkgnd (CDC *pDC);
load your bitmap as before but do it in initinstance.