CPaintDC dc(this);
CDC MemDC;
BITMAP bmpInfo;
MemDC.CreateCompatibleDC(&dc);
CBitmap* pOldBmp = NULL;
bmp.LoadBitmap(IDB_BITMAP_BACK);
bmp.GetBitmap(&bmpInfo);
pOldBmp = MemDC.SelectObject(&bmp);
dc.BitBlt(0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, &MemDC, 0, 0, SRCCOPY);
::TransparentBlt(dc.m_hDC, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, MemDC.m_hDC, 0, 0,
bmpInfo.bmWidth, bmpInfo.bmHeight, RGB(192, 192, 192));
dc.StretchBlt(bmpInfo.bmWidth, 0, bmpInfo.bmWidth * 2, bmpInfo.bmHeight * 2, &MemDC,
0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, SRCCOPY);
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 122;
bf.AlphaFormat = 0;
//반투명 이미지를 출력한다.
::AlphaBlend(pDC->m_hDC,
nW - bmpInfo.bmWidth, nH - bmpInfo.bmHeight,
bmpInfo.bmWidth, bmpInfo.bmHeight,
MemDC.m_hDC,
0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight,
bf);
// 비트맵 파일 로드
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
_T("MSN_Back_Alpha.bmp"),
IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION);
if (hBmp != NULL)
{
::SelectObject(MemDC.m_hDC, hBmp);
dc.BitBlt(0, 0, 147, 164, &MemDC, 0, 0, SRCCOPY);
::DeleteObject(hBmp);
}
MemDC.SelectObject(pOldBmp);
'MFC' 카테고리의 다른 글
OnCreate() ,OnInitialUpdate() 비교 (0) | 2019.03.22 |
---|---|
디버깅에 도움을 주는 assert 매크로에 대하여 (0) | 2019.03.20 |
CDC 클래스 (0) | 2019.03.18 |
SDI 에서 타이틀에 표시되는 문자열 수정하기 (0) | 2019.03.17 |
Enumerating the Installed Fonts (0) | 2019.03.17 |