解決SourceGrid在某些系統上沒法用鼠標滾輪滾動的問題

4.40版源碼,找到SourceGrid/SourceGrid/Common/CustomScrollControl.cs 這個文件spa

 

定位 CustomScrollWheel() 方法,把if條件判斷去掉。或者把rotationDelta的值作相應調整也行。code

 

改後代碼以下:orm

public virtual void CustomScrollWheel(int rotationDelta)
        {
            //if (rotationDelta >= 120 || rotationDelta <= -120)
            //{
                if (VScrollBarVisible)
                {
                    Point current = CustomScrollPosition;
                    int newY = current.Y +
                        SystemInformation.MouseWheelScrollLines * VScrollBar.SmallChange * -Math.Sign(rotationDelta);

                    //check that the value is between max and min
                    if (newY < 0)
                        newY = 0;
                    if (newY > MaximumVScroll)
                        newY = MaximumVScroll;

                    CustomScrollPosition = new Point(current.X, newY);
                }
            //}
        }

 

SourceGrid爲了不過於頻繁的調用滾動操做,加了這個判斷,但沒考慮到有些鼠標的MouseWheel一次滾動是小於這個值的。blog

 

搜不到有人記錄過這個問題,隨記在此,但願遇到一樣問題的同窗能搜到。源碼

相關文章
相關標籤/搜索