CRect CPlayerSeekBar::GetThumbRect() const { const CRect channelRect(GetChannelRect()); long x = channelRect.left + ChannelPointFromPosition(m_rtPos); long y = channelRect.CenterPoint().y; return CRect(x - 6, y - 7, x + 7, y + 8); }
CRect CPlayerSeekBar::GetThumbRect() const { const CRect channelRect(GetChannelRect()); const long x = channelRect.left + ChannelPointFromPosition(m_rtPos); CSize s; s.cy = m_pMainFrame->m_dpi.ScaleFloorY(5); s.cx = m_pMainFrame->m_dpi.TransposeScaledY(channelRect.Height()) / 2 + s.cy; CRect r(x + 1 - s.cx, channelRect.top - s.cy, x + s.cx, channelRect.bottom + s.cy); return r; }
void CPlayerSeekBar::OnPaint() { CPaintDC dc(this); COLORREF dark = GetSysColor(COLOR_GRAYTEXT), white = GetSysColor(COLOR_WINDOW), shadow = GetSysColor(COLOR_3DSHADOW), light = GetSysColor(COLOR_3DHILIGHT), bkg = GetSysColor(COLOR_BTNFACE); // Thumb { auto& pThumb = m_bEnabled ? m_pEnabledThumb : m_pDisabledThumb; if (!pThumb) { CreateThumb(m_bEnabled, dc); ASSERT(pThumb); } CRect r(GetThumbRect()); CRect ri(GetInnerThumbRect(m_bEnabled, r)); CRgn rg, rgi; VERIFY(rg.CreateRectRgnIndirect(&r)); VERIFY(rgi.CreateRectRgnIndirect(&ri)); ExtSelectClipRgn(dc, rgi, RGN_DIFF); VERIFY(dc.BitBlt(r.TopLeft().x, r.TopLeft().y, r.Width(), r.Height(), pThumb.get(), 0, 0, SRCCOPY)); ExtSelectClipRgn(dc, rg, RGN_XOR); m_lastThumbRect = r; } const CRect channelRect(GetChannelRect()); // Chapters if (m_bHasDuration) { CAutoLock lock(&m_csChapterBag); if (m_pChapterBag) { for (DWORD i = 0; i < m_pChapterBag->ChapGetCount(); i++) { REFERENCE_TIME rtChap; if (SUCCEEDED(m_pChapterBag->ChapGet(i, &rtChap, nullptr))) { long chanPos = channelRect.left + ChannelPointFromPosition(rtChap); CRect r(chanPos, channelRect.top, chanPos + 1, channelRect.bottom); if (r.right < channelRect.right) { r.right++; } ASSERT(r.right <= channelRect.right); dc.FillSolidRect(&r, dark); dc.ExcludeClipRect(&r); } else { ASSERT(FALSE); } } } } // Channel { dc.FillSolidRect(&channelRect, m_bEnabled ? white : bkg); CRect r(channelRect); r.InflateRect(1, 1); dc.Draw3dRect(&r, shadow, light); dc.ExcludeClipRect(&r); } // Background { CRect r; GetClientRect(&r); dc.FillSolidRect(&r, bkg); } }