[英]Black background with image in center using GDI
我在窗口中心显示图像。 但是我希望窗口的所有其他区域为黑色。 我该如何实现? 我正在使用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);
使用ExcludeClipRect
裁剪图像的区域,然后使用FillRect
填充图像周围的背景。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.