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

GetNewTopRowIndex() protected method

Returns the correct new value for the scrollbar.Value property. The ValueChanged event handler invalidates the control, because if the thumb track is clicked, then the Value property is changed without coming through this method.
protected GetNewTopRowIndex ( int previousTopRowIndex, int howMany ) : int
previousTopRowIndex int
howMany int
return int
        protected int GetNewTopRowIndex(int previousTopRowIndex, int howMany)
        {
            int visibleRows = this.vScrollBar.LargeChange - 1;
            bool down = (howMany > 0);

            int max = Math.Abs(howMany);

            int column = this.ColumnModel.NextVisibleColumn(-1);
            CellPos newCell = new CellPos(previousTopRowIndex, column);  // The row currently at the top

            for (int i = 0; i < max; i++)
            {
                // The first cell on the row we are going to (if all is well)
                // Changed to fix scrolling bug (ID - 2848790) reported by Tom Nolan ( lordicarus )
                newCell = this.FindNextVisibleCell(newCell, true, down, false, false, true);
            }

            return newCell.Row;
        }
Table