滚动条信息结构体SCROLLINFO中元素 int  nMin; int  nMax; UINT nPage; 分别表示什么意思呢?MSDN上的解释不是很明白啊。
还有那个OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)的第一个参数nSBCode
SB_LEFT    SB_RIGHT是怎样的状态?

解决方案 »

  1.   

    MSDN上的解释已经相当明白了呀?
    void CMyView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
    {
       // Get the minimum and maximum scroll-bar positions.
       int minpos;
       int maxpos;
       pScrollBar->GetScrollRange(&minpos, &maxpos); 
       maxpos = pScrollBar->GetScrollLimit();   // Get the current position of scroll box.
       int curpos = pScrollBar->GetScrollPos();   // Determine the new position of scroll box.
       switch (nSBCode)
       {
       case SB_LEFT:      // Scroll to far left.
          curpos = minpos;
          break;   case SB_RIGHT:      // Scroll to far right.
          curpos = maxpos;
          break;   case SB_ENDSCROLL:   // End scroll.
          break;   case SB_LINELEFT:      // Scroll left.
          if (curpos > minpos)
             curpos--;
          break;   case SB_LINERIGHT:   // Scroll right.
          if (curpos < maxpos)
             curpos++;
          break;   case SB_PAGELEFT:    // Scroll one page left.
       {
          // Get the page size. 
          SCROLLINFO   info;
          pScrollBar->GetScrollInfo(&info, SIF_ALL);
       
          if (curpos > minpos)
          curpos = max(minpos, curpos - (int) info.nPage);
       }
          break;   case SB_PAGERIGHT:      // Scroll one page right.
       {
          // Get the page size. 
          SCROLLINFO   info;
          pScrollBar->GetScrollInfo(&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).
       pScrollBar->SetScrollPos(curpos);   CView::OnHScroll(nSBCode, nPos, pScrollBar);
    }
      

  2.   

     Scroll to far left.什么意思?把滑动块往左滑很远?我设了断点,然后把滑动块滑来滑去也不会触发断点,所以我不明白
      

  3.   

    在OnLeftButtonDown中调用SetFocus 就能响应了