void DrawBitmap(HDC hdc, int x, int y, HBITMAP hBitmap)
{
HDC hMemDC;
HBITMAP hOldBitmap;
int nWidth, nHeight;
BITMAP bitmapData;
hMemDC = CreateCompatibleDC(hdc);
hOldBitmap = (HBITMAP)SelectObject(hMemDC, hBitmap);
GetObject(hBitmap, sizeof(BITMAP), &bitmapData);
nWidth = bitmapData.bmWidth;
nHeight = bitmapData.bmHeight;
SetStretchBltMode(hdc, HALFTONE);
StretchBlt(hdc, 0, 0, 160, 120, hMemDC, 0, 0, nWidth, nHeight, SRCCOPY);
//BitBlt(hdc, x, y, nWidth, nHeight, hMemDC, 0, 0, SRCCOPY);
SelectObject(hMemDC, hOldBitmap);
DeleteDC(hMemDC);
}
DrawBitmap() 함수
2011. 3. 10. 10:44