Reputation: 526
Im displaying an image in the center of window. However I want all the other area of the window to be black. How do I achieve this? Im using StretchBlt to center the image.Please advice
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);
Upvotes: 1
Views: 298
Reputation: 37152
Use ExcludeClipRect
to clip out the area of the image, and then fill the background around it using FillRect
.
Upvotes: 1