VC 改变对话框背景(添加背景图片)

void About::OnPaint()
{
 CPaintDC dc(this); // device context for painting
 
 // TODO: Add your message handler code here
     CPaintDC   dcc(this);  
          CRect   rect;  
          GetClientRect(&rect);  
          CDC   dcMem;  
          dcMem.CreateCompatibleDC(&dc);  
          CBitmap   bmpBackground;  
          bmpBackground.LoadBitmap(IDB_BITMAP1);  
                  //IDB_BITMAP是你自己的图对应的ID  
          BITMAP   bitmap;  
          bmpBackground.GetBitmap(&bitmap);  
          CBitmap   *pbmpOld=dcMem.SelectObject(&bmpBackground);  
          dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,  
         bitmap.bmWidth,bitmap.bmHeight,SRCCOPY);  
 // Do not call CDialog::OnPaint() for painting messages
}

你可能感兴趣的:(VC 改变对话框背景(添加背景图片))