在MFC中如何用CBitmap类的CreateCompatibleBitmap方法显示位图

来源:百度知道 编辑:UC知道 时间:2024/06/28 06:17:10

CBitmap bitmap;
CDC compatibledc;
CRect rect;
bitmap.LoadBitmap(IDB_BITMAP1);
compatibledc.CreateCompatibleDC(pDC);
compatibledc.SelectObject(&bitmap);
GetClientRect(&rect);
BITMAP bmp;
bitmap.GetBitmap(&bmp);
pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&compatibledc,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);