2个回答
展开全部
CBitmap bmp;
if (bmp.LoadBitmap(IDB_BITMAP1))
{
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);
CDC dcMemory;
CDC* pDC=GetDlgItem(idd_picture)->GetDC();
dcMemory.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);
CRect rect;
GetDlgItem(idd_picture)->GetClientRect(&rect);
int nX = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2; //没看懂什么用- -
int nY = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2;
//pDC->BitBlt(0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 0, 0, SRCCOPY);
pDC->SetStretchBltMode(COLORONCOLOR);
pDC->StretchBlt(0, 0,rect.Width(),rect.Height(),&dcMemory,0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight,SRCCOPY);
dcMemory.SelectObject(pOldBitmap);
ReleaseDC(pDC);
}
if (bmp.LoadBitmap(IDB_BITMAP1))
{
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);
CDC dcMemory;
CDC* pDC=GetDlgItem(idd_picture)->GetDC();
dcMemory.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);
CRect rect;
GetDlgItem(idd_picture)->GetClientRect(&rect);
int nX = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2; //没看懂什么用- -
int nY = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2;
//pDC->BitBlt(0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 0, 0, SRCCOPY);
pDC->SetStretchBltMode(COLORONCOLOR);
pDC->StretchBlt(0, 0,rect.Width(),rect.Height(),&dcMemory,0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight,SRCCOPY);
dcMemory.SelectObject(pOldBitmap);
ReleaseDC(pDC);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
real size image 勾上
追问
设置了 没有用
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询