posts - 131, comments - 12, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

重绘标题栏与边框

Posted on 2012-12-25 09:23 盛胜 阅读(1110) 评论(0)  编辑 收藏 引用

void DrawTitleBar(CDC *pDC);
void *****::DrawTitleBar( CDC *pDC )
{
HWND hWndNew;
hWndNew=GetSafeHwnd();
if (hWndNew)
{
CRect rectClient;
GetClientRect(&rectClient);
CDC* pDisplayMemDC=new CDC;
pDisplayMemDC->CreateCompatibleDC(pDC);
CBitmap *pBitmap=new CBitmap;
BITMAP bm;
CRect rtWnd;
GetWindowRect(&rtWnd);
//重绘标题栏左上角
pBitmap->LoadBitmap(IDB_JZ_ADDBTL);
pBitmap->GetBitmap(&bm);
pDisplayMemDC->SelectObject(pBitmap);
pDC->StretchBlt(0,0,52,29,pDisplayMemDC,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);//539
pBitmap->DeleteObject();
//重绘标题栏
pBitmap->LoadBitmap(IDB_JZ_NEWBTLBK);
pBitmap->GetBitmap(&bm);
pDisplayMemDC->SelectObject(pBitmap);
pDC->StretchBlt(rectClient.left+52,0,rectClient.right,29,pDisplayMemDC,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);//539
pBitmap->DeleteObject();
//重绘左边边框
pBitmap->LoadBitmap(IDB_JZ_BK);
pBitmap->GetBitmap(&bm);
pDisplayMemDC->SelectObject(pBitmap);
pDC->StretchBlt(0,29,4,rtWnd.Height(),pDisplayMemDC,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
pBitmap->DeleteObject();
//重绘右边边框
pBitmap->LoadBitmap(IDB_JZ_BK);
pBitmap->GetBitmap(&bm);
pDisplayMemDC->SelectObject(pBitmap);
pDC->StretchBlt(rtWnd.Width()-6,29,6,rtWnd.Height(),pDisplayMemDC,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
pBitmap->DeleteObject();
//重绘底部边框
pBitmap->LoadBitmap(IDB_JZ_BK);
pBitmap->GetBitmap(&bm);
pDisplayMemDC->SelectObject(pBitmap);
pDC->StretchBlt(0,rtWnd.Height()-4,rtWnd.Width(),4,pDisplayMemDC,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
pBitmap->DeleteObject();
ReleaseDC(pDisplayMemDC);
delete pDisplayMemDC;
delete pBitmap;
}
}

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理