void CPhotoDialog::DrawOpaque(CDC* pDC, CImage* pImage, int alpha) { CDC *pImageDC=CDC::FromHandle(pImage->GetDC()); int imageWidth=pImage->GetWidth(); int imageHeight=pImage->GetHeight(); CBrush brush(RGB(255,255,255)); pDC->FillRect(CRect(0,0,imageWidth,imageHeight),&brush); BLENDFUNCTION bf; bf.AlphaFormat = 0; bf.BlendFlags = 0; bf.BlendOp = AC_SRC_OVER; bf.SourceConstantAlpha = alpha; pDC->AlphaBlend(0, 0, imageWidth, imageHeight, pImageDC, 0, 0, imageWidth, imageHeight, bf); pImage->ReleaseDC(); }