Posted on 2013-03-29 17:30
盛胜 阅读(429)
评论(0) 编辑 收藏 引用
OnPain()
CPaintDC *pdc=&dc;
CRect r;
GetClientRect(&r);
CBitmap *pBitmap= new CBitmap;
BITMAP bm;
pBitmap->LoadBitmap(IDB_BG_NEW);
pBitmap->GetBitmap(&bm);
CDC* pDisplayMemDC = new CDC;
pDisplayMemDC->CreateCompatibleDC(pdc);
pDisplayMemDC->SelectObject(pBitmap);
pdc->StretchBlt(r.left,r.top+30,r.Width(),r.Height()-30,pDisplayMemDC,
0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
pBitmap->DeleteObject();
ReleaseDC(pdc);
ReleaseDC(pDisplayMemDC);
delete pDisplayMemDC;
delete pBitmap;
OnCtlColor
//修改窗口控件背景颜色
if (nCtlColor == CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(#dedede);
pDC->SetBkColor(#383838);
hbr = CreateSolidBrush(#383838);
}
if (nCtlColor == CTLCOLOR_EDIT)
{
pDC->SetTextColor(#dedede);
pDC->SetBkColor(#13344d);
hbr = CreateSolidBrush(#13344d);
}
OnEraseBkgnd
CRect windowRect;
GetWindowRect(windowRect);
ScreenToClient(windowRect);
pDC->FillSolidRect(windowRect, #383838);
return TRUE;