본문 바로가기

Computer Science/Languages

[MFC] BMP 비트맵 투명 그리기

728x90

 

 

 

(Draw, Paint 사용가능)

 

HANDLE bmp;

CBitmap cBitmap;

BITMAP bmpinfo;

//CDC는 pDC

CDC memdc;

bmp = LoadImage(NULL, _T("DDR_Skin/button/bt_Loop.bmp"), IMAGE_BITMAP, 0,0, LR_LOADFROMFILE);

cBitmap.Attach(bmp);

cBitmap.GetBitmap(&bmpinfo);

memdc.CreateCompatibleDC(pDC);

memdc.SelectObject(bmp);

//pDC->BitBlt(chkboxrect.left,chkboxrect.top,bmpinfo.bmWidth,bmpinfo.bmHeight, &memdc, 0,0,SRCCOPY);

pDC->TransparentBlt(chkboxrect.left, chkboxrect.top, bmpinfo.bmWidth, bmpinfo.bmHeight, &memdc, 0, 0, bmpinfo.bmWidth, bmpinfo.bmHeight, RGB(0,0,0));

 

 

 

memdc.DeleteDC();

cBitmap.DeleteObject();