问题描述
- MFC dc显示超大图片 ,但比屏幕小的图片显示不出来
-
CRect rect; CImage image; GetWindowRect(&rect); ScreenToClient(&rect); image.Load(m_strRollPhotos[m_stCurrentPhoto].c_str()); int nImgWidth = image.GetWidth(); int nImgHeight =image.GetHeight(); if(nImgHeight==0)return; CBitmap bitmap; bitmap.Attach(image.Detach()); CClientDC dc(this); CDC memDC; memDC.CreateCompatibleDC(&dc); CBitmap* pbmpOld = memDC.SelectObject(&bitmap); dc.SetStretchBltMode(COLORONCOLOR);//设置拉伸模式,否则图像会不清晰 dc.StretchBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0, nImgWidth, nImgHeight, SRCCOPY);//绘制图像 memDC.SelectObject(pbmpOld); memDC.DeleteDC();
由于我要显示大图片,像素差不多10000*10000的,所以用这种方法显示 ,但是用这种方法后比屏幕小的图片就显示不出来了
时间: 2024-08-28 14:22:30