2014-12-05 37 views
1

Im在窗口中心顯示圖像。不過,我希望窗口的其他區域都是黑色的。我如何實現這一目標? 即時通訊使用StretchBlt居中image.Please建議使用GDI在中心使用圖像的黑色背景

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); 

回答