void CInformationPanel::Draw(HDC hdc,const RECT &PaintRect) { HDC hdcDst; RECT rc; // TCHAR szText[256]; GetClientRect(&rc); if (rc.right>m_Offscreen.GetWidth() || m_FontHeight+m_Style.LineSpacing>m_Offscreen.GetHeight()) m_Offscreen.Create(rc.right,m_FontHeight+m_Style.LineSpacing); hdcDst=m_Offscreen.GetDC(); if (hdcDst==NULL) hdcDst=hdc; HFONT hfontOld=DrawUtil::SelectObject(hdcDst,m_Font); COLORREF crOldTextColor=::SetTextColor(hdcDst,m_Theme.Style.Fore.Fill.GetSolidColor()); int OldBkMode=::SetBkMode(hdcDst,TRANSPARENT); for (int i=0;i<ITEM_PROGRAMINFO;i++) { if (GetDrawItemRect(i,&rc,PaintRect)) m_ItemList[i]->Draw(hdc,rc); } GetItemRect(ITEM_PROGRAMINFO-1,&rc); if (PaintRect.bottom>rc.bottom) { rc.left=PaintRect.left; rc.top=max(PaintRect.top,rc.bottom); rc.right=PaintRect.right; rc.bottom=PaintRect.bottom; ::FillRect(hdc,&rc,m_BackBrush.GetHandle()); } if (IsItemVisible(ITEM_PROGRAMINFO)) { if (m_Theme.ProgramInfoStyle.Back.Border.Type!=TVTest::Theme::BORDER_NONE) { GetItemRect(ITEM_PROGRAMINFO,&rc); TVTest::Theme::Draw(hdc,rc,m_Theme.ProgramInfoStyle.Back.Border); } GetButtonRect(BUTTON_PROGRAMINFOPREV,&rc); DrawProgramInfoPrevNextButton( hdc,rc,false,IsButtonEnabled(BUTTON_PROGRAMINFOPREV), m_HotButton==BUTTON_PROGRAMINFOPREV); GetButtonRect(BUTTON_PROGRAMINFONEXT,&rc); DrawProgramInfoPrevNextButton( hdc,rc,true,IsButtonEnabled(BUTTON_PROGRAMINFONEXT), m_HotButton==BUTTON_PROGRAMINFONEXT); } ::SetBkMode(hdcDst,OldBkMode); ::SetTextColor(hdcDst,crOldTextColor); ::SelectObject(hdcDst,hfontOld); }
void CInformationPanel::Draw(HDC hdc,const RECT &PaintRect) { HDC hdcDst; RECT rc; GetClientRect(&rc); if (rc.right>m_Offscreen.GetWidth() || m_FontHeight+m_Style.LineSpacing>m_Offscreen.GetHeight()) m_Offscreen.Create(rc.right,m_FontHeight+m_Style.LineSpacing); hdcDst=m_Offscreen.GetDC(); if (hdcDst==NULL) hdcDst=hdc; GetItemRect(ITEM_PROGRAMINFO,&rc); if (PaintRect.bottom>rc.bottom) { rc.left=PaintRect.left; rc.top=max(PaintRect.top,rc.bottom); rc.right=PaintRect.right; rc.bottom=PaintRect.bottom; ::FillRect(hdc,&rc,m_BackBrush.GetHandle()); } HFONT hfontOld=DrawUtil::SelectObject(hdcDst,m_Font); for (int i=0;i<NUM_ITEMS;i++) { if (GetDrawItemRect(i,&rc,PaintRect)) m_ItemList[i]->Draw(hdc,rc); } if (IsItemVisible(ITEM_PROGRAMINFO)) { if (m_Theme.ProgramInfoStyle.Back.Border.Type!=TVTest::Theme::BORDER_NONE) { TVTest::Theme::CThemeDraw ThemeDraw(BeginThemeDraw(hdc)); GetItemRect(ITEM_PROGRAMINFO,&rc); ThemeDraw.Draw(m_Theme.ProgramInfoStyle.Back.Border,rc); } } ::SelectObject(hdcDst,hfontOld); }