//在Onpaint函數中加入如下代碼 //----------給窗口設置背景圖片---------------------------- CPaintDC dc(this); CRect myrect; GetClientRect(&myrect); CDC dcMem; dcMem.CreateCompatibleDC(&dc); CBitmap bmpBackground; bmpBackground.LoadBitmap(IDB_BITMAP1); //IDB_BITMAP_TOOL是你自己的圖對應的ID BITMAP bitmap; bmpBackground.GetBitmap(& bitmap); CBitmap *pbmpOld=dcMem.SelectObject(&bmpBackground); dc.StretchBlt(0,0,myrect.Width(),myrect.Height(),&dcMem,0,0, bitmap.bmWidth,bitmap.bmHeight,SRCCOPY);
