private int GetNewIndexFromPageUp()
{
int i;
if (!this.VScroll)
{
// Not enough data to scroll, so go to the top row
i = 0;
}
else
{
int x = topIndex;
int y = this.vScrollBar.Value - (this.vScrollBar.LargeChange - 1);
if (this.FocusedCell.Row > topIndex && this.TableModel[topIndex, this.FocusedCell.Column].Enabled)
{
// Focus is not on the topmost visible row, so without scrolling, put focus on the topmost row
i = topIndex;
}
else
{
// We are already on the topmost visible row, so scroll up by a page
i = Math.Max(-1, this.vScrollBar.Value - (this.vScrollBar.LargeChange - 1));
}
}
return i;
}