//设置对话框背景图
PAINTSTRUCT ps;
CDC *dc = BeginPaint(&ps);
CDC memdc;
CRect rect;
CBitmap bitmap;
BITMAP szbitmap;
bitmap.LoadBitmap( IDB_QAM_MAIN );
bitmap.GetObject( sizeof(BITMAP),&szbitmap );
CSize size( szbitmap.bmWidth,szbitmap.bmHeight );
memdc.CreateCompatibleDC(dc);
CBitmap *oldbitmap=memdc.SelectObject(&bitmap);
GetClientRect(&rect);
dc->StretchBlt(0,0,rect.Width(),rect.Height(),
&memdc,0,0,size.cx,size.cy,SRCCOPY);
memdc.SelectObject(oldbitmap);
memdc.DeleteDC();
EndPaint(&ps);
from:
http://www.360doc.com/showWeb/0/18/157828.aspx