Windows/MFC
CBitmap 비트맵 보이기 (showImage)
aucd29
2013. 10. 2. 17:38
[code]Header[/code]
void showImages(CDC* pDC, UINT nIDResource, int x, int y);
[code]Code[/code]
#include "stdafx.h"
#include "showImage.h"
void showImages(CDC* pDC, UINT nIDResource, int x, int y)
{
CDC MemDC;
BITMAP bm;
CBitmap bitmap;
MemDC.CreateCompatibleDC(pDC);
bitmap.LoadBitmap(nIDResource);
bitmap.GetObject(sizeof(BITMAP),&bm);
CBitmap *pOldBitmap = MemDC.SelectObject(&bitmap);
pDC->BitBlt(x, y, bm.bmWidth, bm.bmHeight, &MemDC, 0, 0, SRCCOPY);
MemDC.SelectObject(pOldBitmap);
}
void showImages(CDC* pDC, UINT nIDResource, int x, int y);
[code]Code[/code]
#include "stdafx.h"
#include "showImage.h"
void showImages(CDC* pDC, UINT nIDResource, int x, int y)
{
CDC MemDC;
BITMAP bm;
CBitmap bitmap;
MemDC.CreateCompatibleDC(pDC);
bitmap.LoadBitmap(nIDResource);
bitmap.GetObject(sizeof(BITMAP),&bm);
CBitmap *pOldBitmap = MemDC.SelectObject(&bitmap);
pDC->BitBlt(x, y, bm.bmWidth, bm.bmHeight, &MemDC, 0, 0, SRCCOPY);
MemDC.SelectObject(pOldBitmap);
}