透明按钮
/*
* 画项
*/
void CImageButton::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rc(lpDrawItemStruct->rcItem);
pDC->SelectStockObject(NULL_BRUSH);
pDC->Ellipse(rc);
}
/*
* 擦除背景
*/
BOOL CImageButton::OnEraseBkgnd(CDC* pDC)
{
CWnd *pParent = GetParent();
CRect rc;
GetWindowRect(rc);
pParent->ScreenToClient(rc);
pParent->InvalidateRect(rc,false);
pParent->UpdateWindow();
CDC *dcParent = pParent->GetDC();
pDC->BitBlt(0,0,rc.Width(),rc.Height(),dcParent,rc.left,rc.top,SRCCOPY);
pParent->ReleaseDC(dcParent);
return true;
}
* 画项
*/
void CImageButton::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rc(lpDrawItemStruct->rcItem);
pDC->SelectStockObject(NULL_BRUSH);
pDC->Ellipse(rc);
}
/*
* 擦除背景
*/
BOOL CImageButton::OnEraseBkgnd(CDC* pDC)
{
CWnd *pParent = GetParent();
CRect rc;
GetWindowRect(rc);
pParent->ScreenToClient(rc);
pParent->InvalidateRect(rc,false);
pParent->UpdateWindow();
CDC *dcParent = pParent->GetDC();
pDC->BitBlt(0,0,rc.Width(),rc.Height(),dcParent,rc.left,rc.top,SRCCOPY);
pParent->ReleaseDC(dcParent);
return true;
}
posted on 2009-01-06 21:51 Xproer-松鼠 阅读(3832) 评论(0) 编辑 收藏 举报