// Automatically enable or disable a scroll bar void StaticEdit::AutoScrollBar(int bar) { // Try the vertical scroll bar first if using both if (bar == SB_BOTH) { EnableScrollBarCtrl(SB_HORZ, false); EnableScrollBarCtrl(SB_VERT, true); if (GetScrollLimit(SB_VERT) == 0) { EnableScrollBarCtrl(SB_VERT, false); } } // Try the horizontal scroll bar if ((bar == SB_HORZ) || (bar == SB_BOTH)) { EnableScrollBarCtrl(SB_HORZ, true); if (GetScrollLimit(SB_HORZ) == 0) { EnableScrollBarCtrl(SB_HORZ, false); } } // Try the vertical scroll bar if ((bar == SB_VERT) || (bar == SB_BOTH)) { EnableScrollBarCtrl(SB_VERT, true); if (GetScrollLimit(SB_VERT) == 0) { EnableScrollBarCtrl(SB_VERT, false); } } }
BOOL CScrollWnd::OnScrollBy(CSize sizeScroll, BOOL bDoScroll) { int xOrig, x; int yOrig, y; // don't scroll if there is no valid scroll range (ie. no scroll bar) CScrollBar* pBar; DWORD dwStyle = GetStyle(); pBar = GetScrollBarCtrl(SB_VERT); if ((pBar != NULL && !pBar->IsWindowEnabled()) || (pBar == NULL && !(dwStyle & WS_VSCROLL))) { // vertical scroll bar not enabled sizeScroll.cy = 0; } pBar = GetScrollBarCtrl(SB_HORZ); if ((pBar != NULL && !pBar->IsWindowEnabled()) || (pBar == NULL && !(dwStyle & WS_HSCROLL))) { // horizontal scroll bar not enabled sizeScroll.cx = 0; } // adjust current x position xOrig = x = GetScrollPos(SB_HORZ); int xMax = GetScrollLimit(SB_HORZ); x += sizeScroll.cx; if (x < 0) x = 0; else if (x > xMax) x = xMax; // adjust current y position yOrig = y = GetScrollPos(SB_VERT); int yMax = GetScrollLimit(SB_VERT); y += sizeScroll.cy; if (y < 0) y = 0; else if (y > yMax) y = yMax; // did anything change? if (x == xOrig && y == yOrig) return FALSE; if (bDoScroll) { // do scroll and update scroll positions ScrollWindow(-(x-xOrig), -(y-yOrig)); //Invalidate(); if (x != xOrig) SetScrollPos(SB_HORZ, x); if (y != yOrig) SetScrollPos(SB_VERT, y); } return TRUE; }
void CRTListCtrl::OnPaint() { int nmax; int npos; nmax = GetScrollLimit(SBS_VERT); m_Container.SetVerRange(0,nmax); npos = GetScrollPos(SBS_VERT); m_Container.SetVerPos(npos); nmax = GetScrollLimit(SBS_HORZ); m_Container.SetHorRange(0,nmax); npos = GetScrollPos(SBS_HORZ); m_Container.SetHorPos(npos); if(!m_bIsEnableSkin)return CListCtrl::OnPaint(); CRect rcArea; CRect rcWnd; GetClientRect(&rcWnd); rcArea = rcWnd; DWORD style = GetStyle(); if((style & LVS_NOCOLUMNHEADER) != LVS_NOCOLUMNHEADER && (style & LVS_REPORT) == LVS_REPORT) { if(IsWindow(m_HeaderCtrl.m_hWnd)) { CRect rtHeader; m_HeaderCtrl.GetWindowRect(&rtHeader); rcArea.top += rtHeader.Height(); } } CClientDC ptDC(this); CDC defDC; CMemDC memDC(&ptDC,rcArea); defDC.CreateCompatibleDC(&ptDC); CBitmap defBmp; CBitmap* defOld; defBmp.CreateCompatibleBitmap(&ptDC,rcWnd.Width(),rcWnd.Height()); defOld = defDC.SelectObject(&defBmp); DefWindowProc(WM_ERASEBKGND, (WPARAM)defDC.m_hDC , 0); DefWindowProc(WM_PAINT, (WPARAM)defDC.m_hDC , 0); CRTDraw::RTDrawBitmap(&memDC,rcArea,m_BackBitmap[BMP_BACK],m_BackBitmapDrawMode[BMP_BACK]); memDC.TransparentBlt(rcArea.left,rcArea.top,rcArea.Width(),rcArea.Height(),&defDC,rcArea.left,rcArea.top,rcArea.Width(),rcArea.Height(),GetSysColor(COLOR_WINDOW)); CPaintDC dc(this); defDC.SelectObject(defOld); }
BOOL CZhfPalette::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { // TODO: 在此添加消息处理程序代码和/或调用默认值 int curpos = GetScrollPos(SB_VERT); int minpos = 0; int maxpos = 0; GetScrollRange(SB_VERT, &minpos, &maxpos); maxpos = GetScrollLimit(SB_VERT); if (zDelta<0) { if (curpos < maxpos) curpos++; } else { if (curpos > minpos) curpos-- ; } SetScrollPos(SB_VERT, curpos); ScrollWindow(0, (m_iOldPosY-curpos)*(m_iCtrlHeight+m_iMarginY)); m_iOldPosY = curpos; return CAdUiPalette::OnMouseWheel(nFlags, zDelta, pt); }
BOOL CHTMLListCtrl::OnMouseWheel( UINT nFlags, short zDelta, CPoint pt ) { int nVertScroll = GetScrollPos(SB_VERT); int maxpos = GetScrollLimit(SB_VERT); if(zDelta < 0) { int nNewPos = min(nVertScroll + 40 , maxpos); SetScrollPos(SB_VERT,nNewPos); UpdateWindow(); } else { int nNewPos = max((nVertScroll - 40) , 0) ; SetScrollPos(SB_VERT, nNewPos); UpdateWindow(); } Invalidate(); return CWnd::OnMouseWheel(nFlags,zDelta,pt); }
void CLogGraph::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { SCROLLINFO info; info.cbSize = sizeof(info); info.fMask = SIF_ALL; GetScrollInfo(SB_HORZ, &info); int minpos, maxpos; GetScrollRange(SB_HORZ, &minpos, &maxpos); maxpos = GetScrollLimit(SB_HORZ); int curpos = GetScrollPos(SB_HORZ); // TRACE("%s : cpos %d npos %x max %d, nsb %d\n", __FUNCTION__, curpos, nPos, maxpos, nSBCode); switch(nSBCode) { case SB_LEFT: curpos = minpos; break; case SB_RIGHT: curpos = maxpos; break; case SB_ENDSCROLL: break; case SB_LINELEFT: // if (curpos - 100 > minpos) // curpos -= 100; // else // curpos = 0; if (curpos > minpos) curpos = max(minpos, curpos - (int)info.nPage); break; case SB_LINERIGHT: // if (curpos + 100 < maxpos) // curpos += 100; if (curpos < maxpos) curpos = min(maxpos, curpos + (int)info.nPage); break; case SB_PAGELEFT: { // SCROLLINFO info; // GetScrollInfo(SB_HORZ, &info, SIF_ALL); if (curpos > minpos) curpos = max(minpos, curpos - (int)info.nPage); } break; case SB_PAGERIGHT: { // SCROLLINFO info; // GetScrollInfo(SB_HORZ, &info, SIF_ALL); if (curpos < maxpos) curpos = min(maxpos, curpos + (int)info.nPage); } break; case SB_THUMBPOSITION: curpos = info.nTrackPos; break; case SB_THUMBTRACK: curpos = info.nTrackPos; break; } m_bDragSel = false; if (curpos < 0) curpos = 0; SetScrollPos(SB_HORZ, curpos); m_nCurrentPos = curpos; // TRACE("cpos %d \n", curpos); redraw(); setNavMode(true); CWnd::OnHScroll(nSBCode, nPos, pScrollBar); }
void CBirchCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { int iScrollBarPos = GetScrollPos( SB_VERT ); CRect rFrame; GetClientRect( rFrame ); switch( nSBCode ) { case SB_LINEUP: iScrollBarPos = max( iScrollBarPos - m_iLineHeight, 0 ); break; case SB_LINEDOWN: iScrollBarPos = min( iScrollBarPos + m_iLineHeight, GetScrollLimit( SB_VERT ) ); break; case SB_PAGEUP: iScrollBarPos = max( iScrollBarPos - rFrame.Height(), 0 ); break; case SB_PAGEDOWN: iScrollBarPos = min( iScrollBarPos + rFrame.Height(), GetScrollLimit( SB_VERT ) ); break; case SB_THUMBTRACK: case SB_THUMBPOSITION: iScrollBarPos = nPos; break; } SetScrollPos( SB_VERT, iScrollBarPos ); if (m_edit) { m_edit->DestroyWindow(); delete m_edit; m_edit = NULL; } Invalidate(); CWnd::OnVScroll(nSBCode, nPos, pScrollBar); }
bool CDComView::IsScrollBarAtBottom() { BOOL bVert, bHorz; CheckScrollBars(bHorz, bVert); if ((GetScrollPos(SB_VERT) >= GetScrollLimit(SB_VERT)) || (bVert == false)) { return true; } return false; }
void CWinScroller::ClipThumbPos(const XLONG& n) { // find out last possible position (from CScrollBar) XLONG lastpos = GetScrollLimit(); if (n < MinVal) ThumbVal = MinVal; else if (n > lastpos) ThumbVal = lastpos; else ThumbVal = n; SnapToGrain(&ThumbVal); // make sure the scroll position always } // coincides with a grain boundary.
void CScrollWnd::CenterOnPoint(CPoint ptCenter) // center in device coords { CRect rect; GetClientRect(&rect); // find size of client window int xDesired = ptCenter.x - rect.Width() / 2; int yDesired = ptCenter.y - rect.Height() / 2; DWORD dwStyle = GetStyle(); if ((dwStyle & WS_HSCROLL) == 0 || xDesired < 0) { xDesired = 0; } else { int xMax = GetScrollLimit(SB_HORZ); if (xDesired > xMax) xDesired = xMax; } if ((dwStyle & WS_VSCROLL) == 0 || yDesired < 0) { yDesired = 0; } else { int yMax = GetScrollLimit(SB_VERT); if (yDesired > yMax) yDesired = yMax; } ASSERT(xDesired >= 0); ASSERT(yDesired >= 0); SetScrollPos(SB_HORZ, xDesired); SetScrollPos(SB_VERT, yDesired); }
void CXTPCoreTreeControl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { if (pScrollBar != NULL) { CWnd::OnVScroll(nSBCode, nPos, pScrollBar); return; } // its horizontal scroll bar int nCurPos = GetScrollPos(SB_VERT); // decide what to do for each diffrent scroll event switch (nSBCode) { case SB_LEFT: nCurPos = 0; break; case SB_RIGHT: nCurPos = GetScrollLimit(SB_VERT); break; case SB_LINELEFT: nCurPos = max(nCurPos - 6, 0); break; case SB_LINERIGHT: nCurPos = min(nCurPos + 6, GetScrollLimit(SB_VERT)); break; case SB_PAGELEFT: nCurPos = max(nCurPos - CXTPClientRect(this).Height(), 0); break; case SB_PAGERIGHT: nCurPos = min(nCurPos + CXTPClientRect(this).Height(), GetScrollLimit(SB_VERT)); break; case SB_THUMBTRACK: case SB_THUMBPOSITION: { SCROLLINFO si; ZeroMemory(&si, sizeof(SCROLLINFO)); si.cbSize = sizeof(SCROLLINFO); si.fMask = SIF_TRACKPOS; if (!GetScrollInfo(SB_VERT, &si)) return; nCurPos = si.nTrackPos; } break; } OnScrollChanged(nCurPos); }
void CScrollWnd::ScrollToPosition(POINT pt) // logical coordinates { ASSERT(m_nMapMode > 0); // not allowed for shrink to fit if (m_nMapMode != MM_TEXT) { CWindowDC dc(NULL); dc.SetMapMode(m_nMapMode); dc.LPtoDP((LPPOINT)&pt); } // now in device coordinates - limit if out of range int xMax = GetScrollLimit(SB_HORZ); int yMax = GetScrollLimit(SB_VERT); if (pt.x < 0) pt.x = 0; else if (pt.x > xMax) pt.x = xMax; if (pt.y < 0) pt.y = 0; else if (pt.y > yMax) pt.y = yMax; ScrollToDevicePosition(pt); }
BOOL CXTPCoreTreeControl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { if (m_bScrollVisible) { int nCurPos = GetScrollPos(SB_VERT); int nDelta = 3 * m_pPaintManager->GetItemHeight(); if (zDelta > 0) nCurPos = max(nCurPos - nDelta, 0); else nCurPos = min(nCurPos + nDelta, GetScrollLimit(SB_VERT)); OnScrollChanged(nCurPos); RedrawControl(); return TRUE; } return CWnd::OnMouseWheel(nFlags, zDelta, pt); }
void CHTMLListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { //nPos is not valid in case of THUMB type msgs see below url //http://support.microsoft.com/kb/q152252/ int nScrollPos = GetScrollPos(SB_VERT); int nLimit = GetScrollLimit(SB_VERT); int nScroll = nLimit; int SCROLL_AMT_Y = 50; switch(nSBCode) { case SB_LINEUP: // Scroll up. case SB_PAGEUP: if(nScrollPos <= 0) { return; } nScroll = min(nScrollPos,SCROLL_AMT_Y); SetScrollPos(SB_VERT,nScrollPos - nScroll); break; case SB_LINEDOWN: // Scroll down. case SB_PAGEDOWN: if(nScrollPos >= nLimit) { return; } nScroll = min(nScroll-nScrollPos,SCROLL_AMT_Y); SetScrollPos(SB_VERT,nScrollPos + nScroll); break; case SB_THUMBPOSITION: { HWND hWndScroll; if ( pScrollBar == NULL ) hWndScroll = m_hWnd; else hWndScroll = pScrollBar->m_hWnd; SCROLLINFO info; info.cbSize = sizeof(SCROLLINFO); info.fMask = SIF_TRACKPOS; ::GetScrollInfo(hWndScroll, SB_VERT, &info); nPos = info.nTrackPos; int nScr = nScrollPos - nPos; SetScrollPos(SB_VERT,nPos); } break; case SB_THUMBTRACK: { HWND hWndScroll; if ( pScrollBar == NULL ) hWndScroll = m_hWnd; else hWndScroll = pScrollBar->m_hWnd; SCROLLINFO info; info.cbSize = sizeof(SCROLLINFO); info.fMask = SIF_TRACKPOS; ::GetScrollInfo(hWndScroll, SB_VERT, &info); nPos = info.nTrackPos; int nScr = nScrollPos - nPos; SetScrollPos(SB_VERT,nPos,FALSE); } break; } Invalidate(); UpdateWindow(); CWnd::OnVScroll(nSBCode, nPos, pScrollBar); }
void CMyTreeCtrl::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default if (nIDEvent == 1000) { // Doesn't matter that we didn't initialize m_timerticks m_timerticks++; POINT pt; GetCursorPos( &pt ); CRect rect; GetClientRect( &rect ); ClientToScreen( &rect ); // NOTE: Screen coordinate is being used because the call // to DragEnter had used the Desktop window. //CImageList::DragMove(pt); HTREEITEM hitem = GetFirstVisibleItem(); int iMaxV = GetScrollLimit(SB_VERT); int iPosV = GetScrollPos(SB_VERT); // The cursor must not only be SOMEWHERE above/beneath the tree control // BUT RIGHT above or beneath it // i.e. the x-coordinates must be those of the control (+/- SCROLL_BORDER) if ( pt.x < rect.left - SCROLL_BORDER ) ; // Too much to the left else if ( pt.x > rect.right + SCROLL_BORDER ) ; // Too much to the right else if( (pt.y < rect.top + SCROLL_BORDER) && iPosV ) { // We need to scroll up // Scroll slowly if cursor near the treeview control int slowscroll = 6 - (rect.top + SCROLL_BORDER - pt.y) / SCROLL_SPEED_ZONE_WIDTH; if( 0 == ( m_timerticks % (slowscroll > 0? slowscroll : 1) ) ) { CImageList::DragShowNolock(FALSE); SendMessage( WM_VSCROLL, SB_LINEUP); SelectDropTarget(hitem); m_hitemDrop = hitem; CImageList::DragShowNolock(TRUE); } } else if( (pt.y > rect.bottom - SCROLL_BORDER) && (iPosV!=iMaxV) ) { // We need to scroll down // Scroll slowly if cursor near the treeview control int slowscroll = 6 - (pt.y - rect.bottom + SCROLL_BORDER ) / SCROLL_SPEED_ZONE_WIDTH; if( 0 == ( m_timerticks % (slowscroll > 0? slowscroll : 1) ) ) { CImageList::DragShowNolock(FALSE); SendMessage( WM_VSCROLL, SB_LINEDOWN); int nCount = GetVisibleCount(); for ( int i=0; i<nCount-1; ++i ) hitem = GetNextVisibleItem(hitem); if( hitem ) SelectDropTarget(hitem); m_hitemDrop = hitem; CImageList::DragShowNolock(TRUE); } } // The cursor must be in a small zone IN the treecontrol at the left/right int iPosH = GetScrollPos(SB_HORZ); int iMaxH = GetScrollLimit(SB_HORZ); if ( !rect.PtInRect(pt) ) return; // not in TreeCtrl else if ( (pt.x < rect.left + SCROLL_BORDER) && (iPosH != 0) ) { // We need to scroll to the left CImageList::DragShowNolock(FALSE); SendMessage(WM_HSCROLL, SB_LINELEFT); CImageList::DragShowNolock(TRUE); } else if ( (pt.x > rect.right - SCROLL_BORDER) && (iPosH != iMaxH) ) { // We need to scroll to the right CImageList::DragShowNolock(FALSE); SendMessage(WM_HSCROLL, SB_LINERIGHT); CImageList::DragShowNolock(TRUE); } } // CDialog::OnTimer(nIDEvent); }
/************************************************************************ PositionScrollBars ListCtrl 기본 스크롤바를 숨기고 비트맵 스크롤 바로 변경한다. @PARAM : @RETURN : @REMARK : http://www.codeguru.com/forum/showthread.php?s=36a2689f1a0c1395ba30950f993c559b&threadid=178221&highlight=hide+scrollbars @AUTHOR : youngchang ([email protected]) @HISTORY : 2006/01/02:CREATED ************************************************************************/ void CFishListCtrl::PositionScrollBars() { enum { SCROLLBAR_WIDTH=12, SCROLLBAR_HEIGHT=12}; CWnd* pParent = GetParent(); CRect windowRT; GetWindowRect(&windowRT); int nTitleBarHeight = 0; if(pParent->GetStyle() & WS_CAPTION) nTitleBarHeight = GetSystemMetrics(SM_CYSIZE); // WINDOW SYSTEM VALUE int nDialogFrameHeight = 0; int nDialogFrameWidth = 0; int cxvs = 0; int cyvs = 0; int cxhs = 0; int cyhs = 0; if (pParent->GetStyle() & WS_VSCROLL) { cxvs = GetSystemMetrics (SM_CXVSCROLL); cyvs = GetSystemMetrics (SM_CYVSCROLL); } if (pParent->GetStyle() & WS_HSCROLL) { cxhs = GetSystemMetrics (SM_CXHSCROLL); cyhs = GetSystemMetrics (SM_CYHSCROLL); } if((pParent->GetStyle() & WS_BORDER)) { nDialogFrameHeight = GetSystemMetrics(SM_CYDLGFRAME); nDialogFrameWidth = GetSystemMetrics(SM_CYDLGFRAME); } if(pParent->GetStyle() & WS_THICKFRAME) { nDialogFrameHeight+=1; nDialogFrameWidth+=1; } pParent->ScreenToClient(&windowRT); windowRT.InflateRect(nDialogFrameWidth, nTitleBarHeight+nDialogFrameHeight, nDialogFrameWidth, nTitleBarHeight+nDialogFrameHeight); // Vertical Scrollbar BOOL bVShow, bHShow; BOOL bVChanged = FALSE, bHChanged = FALSE; CRect regionRT = windowRT; if (GetScrollLimit(SB_VERT) != 0) { if(!m_SkinVerticleScrollbar.IsWindowVisible()) bVChanged = TRUE; regionRT.left = windowRT.left-nDialogFrameWidth; regionRT.right = windowRT.right-nDialogFrameWidth - SCROLLBAR_WIDTH; m_SkinVerticleScrollbar.ShowWindow(SW_NORMAL); bVShow = TRUE; } else { if(m_SkinVerticleScrollbar.IsWindowVisible()) bVChanged = TRUE; m_SkinVerticleScrollbar.ShowWindow(SW_HIDE); bVShow = FALSE; } // Horizontal Scrollbar if (GetScrollLimit(SB_HORZ) != 0) { if(!m_SkinHorizontalScrollbar.IsWindowVisible()) bHChanged = TRUE; regionRT.top = windowRT.top-nTitleBarHeight-nDialogFrameHeight; regionRT.bottom = windowRT.bottom-nTitleBarHeight-nDialogFrameHeight - SCROLLBAR_HEIGHT; m_SkinHorizontalScrollbar.ShowWindow(SW_NORMAL); bHShow = TRUE; } else { if(m_SkinHorizontalScrollbar.IsWindowVisible()) bHChanged = TRUE; m_SkinHorizontalScrollbar.ShowWindow(SW_HIDE); bHShow = FALSE; } if (bVChanged) m_ctrlHeader.Invalidate(FALSE); HRGN iehrgn = CreateRectRgn(regionRT.left, regionRT.top, regionRT.right, regionRT.bottom); SetWindowRgn(iehrgn, TRUE); // SCROLLBAR SIZE SET CRect vBar(windowRT.right-nDialogFrameWidth - SCROLLBAR_WIDTH, windowRT.top-nTitleBarHeight-nDialogFrameHeight- SCROLLBAR_WIDTH + 1, windowRT.right+0-nDialogFrameWidth, windowRT.bottom-nTitleBarHeight-nDialogFrameHeight); CRect hBar(windowRT.left-nDialogFrameWidth, windowRT.bottom-nTitleBarHeight-nDialogFrameHeight - SCROLLBAR_HEIGHT, bVShow ? windowRT.right-nDialogFrameWidth - SCROLLBAR_WIDTH:windowRT.right-nDialogFrameWidth, windowRT.bottom+0-nTitleBarHeight-nDialogFrameHeight); // SCROLLBAR WINDOWS RESIZING m_SkinVerticleScrollbar.SetWindowPos(NULL,vBar.left,vBar.top,vBar.Width(),vBar.Height(),SWP_NOZORDER); m_SkinHorizontalScrollbar.SetWindowPos(NULL,hBar.left,hBar.top,hBar.Width(),hBar.Height(),SWP_NOZORDER); m_SkinHorizontalScrollbar.UpdateThumbPosition(); m_SkinVerticleScrollbar.UpdateThumbPosition(); }
void CZhfPalette::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { // TODO: 在此添加消息处理程序代码和/或调用默认值 int minpos = 0; int maxpos = 0; GetScrollRange(SB_VERT, &minpos, &maxpos); maxpos = GetScrollLimit(SB_VERT); // Get the current position of scroll box. int curpos = GetScrollPos(SB_VERT); // Determine the new position of scroll box. switch (nSBCode) { case SB_TOP: // Scroll to far left. curpos = minpos; break; case SB_BOTTOM: // Scroll to far right. curpos = maxpos; break; case SB_ENDSCROLL: // End scroll. break; case SB_LINEUP: // Scroll left. if (curpos > minpos) curpos--; break; case SB_LINEDOWN: // Scroll right. if (curpos < maxpos) curpos++; break; case SB_PAGEUP: // Scroll one page left. { // Get the page size. SCROLLINFO info; GetScrollInfo(SB_VERT, &info, SIF_ALL); if (curpos > minpos) curpos = max(minpos, curpos - (int) info.nPage); } break; case SB_PAGEDOWN: // Scroll one page right. { // Get the page size. SCROLLINFO info; GetScrollInfo(SB_VERT, &info, SIF_ALL); if (curpos < maxpos) curpos = min(maxpos, curpos + (int) info.nPage); } break; case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position curpos = nPos; // of the scroll box at the end of the drag operation. break; case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the curpos = nPos; // position that the scroll box has been dragged to. break; } // Set the new position of the thumb (scroll box). SetScrollPos(SB_VERT, curpos); ScrollWindow(0,(m_iOldPosY-curpos)*(m_iCtrlHeight+m_iMarginY)); m_iOldPosY = curpos; UpdateWindow(); CAdUiPalette::OnVScroll(nSBCode, nPos, pScrollBar); }