读书人

小弟我的位图如何在dc中显示不出来啊大

发布时间: 2012-02-23 22:01:34 作者: rapoo

我的位图怎么在dc中显示不出来啊,大家帮我看看
CBitmap bitmap;
CreateBitmap(WIDTH,HEIGHT,1,1,pixelMatrix);
CDC mendc;
mendc.CreateCompatibleDC(dc);
poldbmp=mendc.SelectObject(bitmap);
dc-> BitBlt(100,100,bitmap.GetBitmapDimension().cx ,bitmap.GetBitmapDimension().cy,&mendc,0,0,SRCCOPY);
不知道什么原因,显示不出来,这里dc是系统的dc

[解决办法]
BitBlt功能有限,建议使用SetDIBitsToDevice(
HDC hdc, // handle to DC
int XDest, // x-coord of destination upper-left corner
int YDest, // y-coord of destination upper-left corner
DWORD dwWidth, // source rectangle width
DWORD dwHeight, // source rectangle height
int XSrc, // x-coord of source lower-left corner
int YSrc, // y-coord of source lower-left corner
UINT uStartScan, // first scan line in array
UINT cScanLines, // number of scan lines
CONST VOID *lpvBits, // array of DIB bits
CONST BITMAPINFO *lpbmi, // bitmap information
UINT fuColorUse // RGB or palette indexes
);

读书人网 >C++

热点推荐