怎么获得StretchBlt后的位图句柄
如何获得StretchBlt后的位图句柄
新人第一次问问题,实在是找了好久没找到合适的解决方案。
我的过程是这样的,为BS_BITMAP样式按钮加载合适尺寸的图片,用c加api的:
1. 先加载位图,2. 再用StretchBlt修改图片尺寸,3. 再用BM_SETIMAGE消息把位图传到按钮上。
但是用BM_SETIMAGE消息把位图传到按钮上这个步骤,需要合适尺寸的位图句柄。可是我在StretchBlt的过程中得不到修改后的位图句柄。
怎样获得修改尺寸后的位图句柄,或者解决这个问题的别的办法。
请各位大牛帮帮忙吧
------解决思路----------------------
// New CBitmap
BitmapNew.CreateCompatibleBitmap(&dcSrc,nWidthNew,nHeightNew);
// Scale Bitmap
dcDst.SelectObject(&BitmapNew);
//Maps pixels from the source rectangle into blocks of pixels
//in the destination rectangle. The average color over
//the destination block of pixels approximates the color of the source pixels.
dcDst.SetStretchBltMode(HALFTONE) ;
dcDst.StretchBlt(0, 0, nWidthNew, nHeightNew, &dcSrc, 0, 0, nWidthOld, nHeightOld, SRCCOPY);
你要的是
BitmapNew
新人第一次问问题,实在是找了好久没找到合适的解决方案。
我的过程是这样的,为BS_BITMAP样式按钮加载合适尺寸的图片,用c加api的:
1. 先加载位图,2. 再用StretchBlt修改图片尺寸,3. 再用BM_SETIMAGE消息把位图传到按钮上。
但是用BM_SETIMAGE消息把位图传到按钮上这个步骤,需要合适尺寸的位图句柄。可是我在StretchBlt的过程中得不到修改后的位图句柄。
怎样获得修改尺寸后的位图句柄,或者解决这个问题的别的办法。
请各位大牛帮帮忙吧
------解决思路----------------------
// New CBitmap
BitmapNew.CreateCompatibleBitmap(&dcSrc,nWidthNew,nHeightNew);
// Scale Bitmap
dcDst.SelectObject(&BitmapNew);
//Maps pixels from the source rectangle into blocks of pixels
//in the destination rectangle. The average color over
//the destination block of pixels approximates the color of the source pixels.
dcDst.SetStretchBltMode(HALFTONE) ;
dcDst.StretchBlt(0, 0, nWidthNew, nHeightNew, &dcSrc, 0, 0, nWidthOld, nHeightOld, SRCCOPY);
你要的是
BitmapNew