16,549
社区成员




HDC hdcMem = CreateCompatibleDC(NULL);
HBITMAP hBitmap = CreateCompatibleBitmap(NULL, 1920, 400);
CImage image;
HBRUSH hBrush_black = CreateSolidBrush(RGB(0, 0, 0)); //黑
CRect* pRect = new CRect(0, 0, 1920-1, 400-1);
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBitmap);
FillRect(hdcMem, pRect , hBrush_black); //背景色
image.Attach(hBitmap);// 此时CImage将管理hBitmap的生命周期
image.Save(L"d:\\2.bmp");
delete pRect ;pRect =NULL;
DeleteObject(hBrush_black);