VOID CDUIProgressBarBase::PaintForgnd(HDC dc) { RECT rtContent = GetContentRect(); CRefPtr<CImageList> pImage = m_uiData.m_imageBK; if(!pImage.IsNull() && !pImage->IsNull() && pImage->GetItemCount() >= PROCRSS_BAR_IMAGE_COUNT) { RECT rtTemp = {0}; GetProgressRect(rtContent, rtTemp); if(!IsRectEmpty(&rtTemp)) { CDUIRenderClip clip2(dc, rtTemp); if(IsVertical()) { pImage->VerticalStretch(dc, rtContent, PROCRSS_BAR_IMAGE_FORE); } else { pImage->HorizontalStretch(dc, rtContent, PROCRSS_BAR_IMAGE_FORE); } } } else { DUI_ASSERT(FALSE); } }
// Linux does not reliably generate EraseBackground // events here, so use Paint events void CSimplePanelBase::OnPaint(wxPaintEvent& /*event*/) { wxPaintDC dc(this); if (!m_GotBGBitMap) { MakeBGBitMap(); } dc.DrawBitmap(m_TaskPanelBGBitMap, 0, 0); wxPen oldPen= dc.GetPen(); wxBrush oldBrush = dc.GetBrush(); int oldMode = dc.GetBackgroundMode(); wxCoord w, h; wxPen bgPen(*wxLIGHT_GREY, 3); wxBrush bgBrush(*wxLIGHT_GREY, wxTRANSPARENT); dc.SetBackgroundMode(wxSOLID); dc.SetPen(bgPen); dc.SetBrush(bgBrush); dc.GetSize(&w, &h); dc.DrawRoundedRectangle(0, 0, w, h, RECTANGLERADIUS); #ifdef __WXMAC__ // Mac progress bar can be hard to see on a colored // background, so put it on a white background wxRect* progressRect = GetProgressRect(); if (progressRect) { dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxWHITE_BRUSH); dc.DrawRoundedRectangle(progressRect->x, progressRect->y, progressRect->width, progressRect->height, 2); } #endif // Restore Mode, Pen and Brush dc.SetBackgroundMode(oldMode); dc.SetPen(oldPen); dc.SetBrush(oldBrush); }