【发布时间】:2015-02-03 06:33:34
【问题描述】:
我在窗口中心显示图像。但是我希望窗口的所有其他区域都是黑色的。我如何实现这一目标? 我使用 StretchBlt 将图像居中。请建议
RECT clientRect,rect;
HDC hDC = GetDC(hwnd);
HDC hMemDC = CreateCompatibleDC(hDC);
::SelectObject(hMemDC, bmp);
GetClientRect(hwnd, &clientRect);
StretchBlt(hDC, clientRect.left, clientRect.top, newwidth, newheight, hMemDC, 0, 0,bmpdata.bmWidth, bmpdata.bmHeight,SRCCOPY);
【问题讨论】: