XPTable.Models.Table.EnsureSafeVScrollValue C# (CSharp) Method

EnsureSafeVScrollValue() private method

Returns a safe value that can be used for the .Value property of the V scrollbar (that is within the min and max).
private EnsureSafeVScrollValue ( int newValue ) : int
newValue int
return int
        private int EnsureSafeVScrollValue(int newValue)
        {
            int newTopRowIndex = newValue;
            int visibleRows = this.vScrollBar.LargeChange - 1;

            if (newTopRowIndex < 0)
            {
                // Can get here with the mousewheel going up
                newTopRowIndex = 0;
            }
            else if (newTopRowIndex > this.vScrollBar.Maximum - visibleRows)
            {
                // Can get here with the mousewheel going down
                newTopRowIndex = this.vScrollBar.Maximum - visibleRows;
            }
            return newTopRowIndex;
        }
Table