void CFooterBar::ControlBnt::Draw(HDC hDC,ePipeline* Pipe /*=NULL*/){ RECT rc = GetArea(); HFONT GuiFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); HFONT OldFont = (HFONT)::SelectObject(hDC, GuiFont ); DWORD Format = DT_CENTER|DT_VCENTER|DT_SINGLELINE; COLORREF crBorder = RGB(192,192,192); COLORREF crFkg = RGB(0,0,0); COLORREF crBkg = RGB(192,192,192); //画文字边框 // DrawEdge(hDC,m_Area,crBorder); DeflateRect(&rc,1,1,1,1); COLORREF Oldcr; if(m_State & SPACE_DISABLE){ DrawEdge(hDC,&rc,crBorder); Oldcr = ::SetTextColor(hDC,crBkg); ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,Format); ::SetTextColor(hDC,Oldcr); } else if(m_State & SPACE_SELECTED){ DrawEdge(hDC,&rc,crBorder); //FillRect(hDC,rc,crFkg); Oldcr = ::SetTextColor(hDC,crFkg); ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,Format); ::SetTextColor(hDC,Oldcr); } else if(m_State&SPACE_FOCUSED){ FillRect(hDC,rc,crBkg); DrawEdge(hDC,&rc,BDR_RAISEDOUTER|BDR_RAISEDINNER,BF_BOTTOMRIGHT|BF_TOPLEFT); Oldcr = ::SetTextColor(hDC,crFkg); rc.left-=1; rc.top -=1; ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,Format); ::SetTextColor(hDC,Oldcr); } else { FillRect(hDC,rc,crBkg); DrawEdge(hDC,&rc,BDR_RAISEDOUTER|BDR_RAISEDINNER,BF_BOTTOMRIGHT|BF_TOPLEFT); COLORREF Oldcr = ::SetTextColor(hDC,crFkg); ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,Format); ::SetTextColor(hDC,Oldcr); } ::SelectObject(hDC,OldFont ); }
void ObjectHeader::Draw(HDC hDC, ePipeline* Pipe){ //输出内容 RECT rc = GetArea(); COLORREF Oldcr = ::SetTextColor(hDC,m_crText); rc.right = rc.left + 22; rc.bottom = rc.top + 22; DeflateRect(&rc,4,4,4,4); if(m_State & SPACE_DISABLE) FillRect(hDC,&rc,RGB(128,0,0)); else FillRect(hDC,&rc,RGB(255,0,0)); rc.left = rc.right+5; rc.right = m_AreaRight-10; //rc.bottom = rc.top+22; ::DrawText(hDC,m_Title.c_str(),m_Title.size(),&rc,DT_LEFT|DT_EXPANDTABS|DT_END_ELLIPSIS| DT_WORDBREAK|DT_NOPREFIX|DT_VCENTER); rc.top = m_AreaTop + 22; rc.bottom = m_AreaBottom-4; //名字 rc.right = rc.left+170; ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,DT_LEFT|DT_EXPANDTABS|DT_END_ELLIPSIS| DT_WORDBREAK|DT_NOPREFIX|DT_VCENTER); //给header添加一根横线 rc = GetArea(); rc.top = rc.bottom-4; rc.bottom = rc.bottom-2; FillRect(hDC,&rc,m_crText); ::SetTextColor(hDC,Oldcr); };
inline void CRect::DeflateRect(LPCRECT pRect) { DeflateRect(pRect->left, pRect->top, pRect->right, pRect->bottom); }
inline void CRect::operator-=(LPCRECT pRect) { DeflateRect(pRect); }
inline void CRectTplt<T>::DeflateRect(const CRectTplt* pRect) { DeflateRect(pRect->left, pRect->top, pRect->right, pRect->bottom); }
inline void CRectTplt<T>::operator-=(const CRectTplt* pRect) { DeflateRect(pRect); }