还是自己解决的,哎!
在OnEraseBkgnd加代码:
CDC dcMem,dcMask;
CRect rect;
CBitmap m_bmpmask;
GetWindowRect(&rect);
dcMem.CreateCompatibleDC(pDC);
dcMask.CreateCompatibleDC(pDC);
m_bmpmask.CreateBitmap(rect.Width(),rect.Height(),1,1,NULL);
CPen pen(PS_SOLID,1,RGB(0,0,180));
CPen *pOldpen= pDC->SelectObject(&pen);
//Background
dcMem.SelectObject(&cBmpBack);
CRect rect_bg(0,0, rect.right, rect.bottom);
pDC->BitBlt(rect_bg.left,rect_bg.top,rect_bg.Width(),
rect_bg.Height(),&dcMem,0,0,SRCCOPY);
//Bitmap1
dcMem.SelectObject(&cBmp1);
dcMask.SelectObject(&m_bmpmask);
dcMem.SetBkColor(RGB(0,0,0));
dcMask.BitBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,SRCCOPY);
CRect rect1(0,0,25,25);
pDC->BitBlt(0,0,rect1.Width(),rect1.Height(),&dcMem,0,0,SRCINVERT);
pDC->BitBlt(0,0,rect1.Width(),rect1.Height(),&dcMask,0,0,SRCAND);
pDC->BitBlt(0,0,rect1.Width(),rect1.Height(),&dcMem,0,0,SRCINVERT);
COLORREF col1 = pDC->SetTextColor(RGB(255,255,255));
int tr1 = pDC->SetBkMode(TRANSPARENT);
pDC->DrawText("Monday,April 02,2007",
CRect(rect1.left+29,rect1.top+5,rect.right,rect.bottom),NULL);
pDC->MoveTo(0,25);
pDC->LineTo(rect.right,25);
pDC->SetTextColor(col1);
pDC->SetBkMode(tr1);
pDC->DeleteDC();
return true; |