HRESULT WINAPI InstallSkinScrollBar(HWND hWnd) { BOOL f = InitializeCoolSB(hWnd); ATLASSERT( f ); if( f ) { RECT rc; BOOL fScroll = FALSE; CComPtr<ISkinScheme> pss; GetCurrentScheme(&pss); if ( pss ) fScroll = pss->GetRect(SCROLLBAR, SBP_ARROWBTN, 1, &rc); int nWidth = 0 ; int nHeight = 0; if ( fScroll ) { nWidth = rc.right - rc.left; nHeight = rc.bottom - rc.top; } f = CoolSB_SetStyle(hWnd, SB_BOTH, CSBS_NORMAL); ATLASSERT( f ); f = CoolSB_SetSize(hWnd, SB_BOTH, nWidth > 0 ? nWidth : 15, nHeight > 0 ? nHeight : 15); ATLASSERT( f ); f = CoolSB_SetMinThumbSize(hWnd, SB_BOTH, nWidth); ATLASSERT( f ); return S_OK; } return S_FALSE; }
void CMyListCtrl::SetScrollBitmap(CDibBitmap* pBitmapVert,CDibBitmap* pBitmapHorz) { m_pBitmapScrollHorz = pBitmapHorz; m_pBitmapScrollVert = pBitmapVert; int w,h; w = h = 15; if( m_pBitmapScrollHorz && m_pBitmapScrollVert ) { h = m_pBitmapScrollVert->GetHeight() / 3; w = m_pBitmapScrollVert->GetWidth() / 6; } //InitializeCoolSB(m_hWnd); //CoolSB_SetStyle(m_hWnd, SB_BOTH, CSBS_HOTTRACKED); CoolSB_SetSize(m_hWnd, SB_BOTH, h, w); ::CoolSB_SetMinThumbSize(m_hWnd, SB_BOTH, 8); }
void CMyListCtrl::OnPaint() { if(!m_bInit ) { int w,h; w = h = 15; if( m_pBitmapScrollHorz && m_pBitmapScrollVert ) { h = m_pBitmapScrollVert->GetHeight() / 3; w = m_pBitmapScrollVert->GetWidth() / 6; } InitializeCoolSB(m_hWnd); CoolSB_SetStyle(m_hWnd, SB_BOTH, CSBS_HOTTRACKED); CoolSB_SetSize(m_hWnd, SB_BOTH, h, w); ::CoolSB_SetMinThumbSize(m_hWnd, SB_BOTH, 8); m_bInit = true; } CRect rectClient; GetClientRect(rectClient); CRect rectClip; GetUpdateRect(rectClip,FALSE); if( rectClip.right < rectClient.right ) { rectClip.right = rectClient.right; } int width = 0; for(int i = 0 ; i<m_mapColumnInfo.size(); i++) width += GetColumnWidth(i); if(rectClip.left >= width) rectClip.left = width -1; InvalidateRect( rectClip ); __super::OnPaint(); }