读书人

透明背景的处置

发布时间: 2012-11-03 10:57:44 作者: rapoo

透明背景的处理
1.建立bitmap资源
2.增加CBitmap对象在类中
3.在对话框OnPaint()中
CDC ImageDC;
bmpSoftVer.LoadBitmap(IDB_CN_ABOUT);
BITMAP bm;
bmpSoftVer.GetBitmap(&bm);
iSoftVerWidth = bm.bmWidth;
iSoftVerHeight = bm.bmHeight;
ImageDC.CreateCompatibleDC(&dc);
CBitmap *pOldImageBMP = ImageDC.SelectObject(&bmpSoftVer);
dc.BitBlt(0, 0, m_iSoftVerWidth, m_iSoftVerHeight, &ImageDC, 0, 0, SRCCOPY);

COLORREF crMask = RGB(0xFF, 0xFF, 0xFF);
bmpBeyondLogo.LoadBitmap(IDB_CN_BEYOND);
bmpBeyondLogo.GetBitmap(&bm);
iBeyondLogoWidth= bm.bmWidth;
iBeyondLogoHeight= bm.bmHeight;
ImageDC.SelectObject(&bmpBeyondLogo);
TransparentBlt(dc.m_hDC, 40, 230, iBeyondLogoWidth,iBeyondLogoHeight, ImageDC.m_hDC, 0, 0, iBeyondLogoWidth, iBeyondLogoHeight,crMask); ImageDC.SelectObject(pOldImageBMP);

读书人网 >编程

热点推荐