解决方案 »

  1.   

    The SetScrollInfo function performs range checking on the values specified by the nPage and nPos members of the SCROLLINFO structure. The nPage member must specify a value from 0 to nMax - nMin +1. The nPos member must specify a value between nMin and nMax - max(nPage – 1, 0). If either value is beyond its range, the function sets it to a value that is just within the range. 
    也就是说SetScrollInfo后,设置的参数和内部生效的参数可能会有差别,再使用GetScrollInfo可以得到真正生效的参数
      

  2.   

    1、是的。
    2、LS说得对,你说得也对,去掉也不错,其实就是为了提高代码效率,如果现在滚动条已经在最上面了,你用鼠标点击向上,如果用-=1会得出越界的位置,而SetScrollInfo会自动修正这个位置,你可以这么试验一下,把if那句注释掉,在ScrollWindow这个函数处F9设置断点,运行程序后用鼠标点击向上的滚动标志,此时程序会中断在ScrollWindows处,而你加上了if判断,就不会中断,其实就是避免了不必要的重绘。