本人在基于Dialog的vc编程中,在OnPaint()函数中添加了如下代码,
         CDC *pDC;
CBitmap bitmap;
bitmap.LoadBitmap (IDB_BITMAP2);
pDC=this->GetDC ();    //在OnPaint()函数中,既然没有DC,就应该获取到当前的DC,不然就会出现存储错误 BITMAP bmp;             //创建一个位图的结构体
bitmap.GetBitmap (&bmp);          //获取位图的属性 CDC dcCompatible;
dcCompatible.CreateCompatibleDC (pDC);
         dcCompatible.SelectObject (&bitmap);
CRect rect;
GetClientRect(rect);
//pDC->BitBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,0,0,SRCCOPY);
    pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);   但是在窗口移动时,对话框里的控件就被图片遮住了,请高手指教。