簡體   English   中英

黑色背景,使用GDI的中心圖像

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM