SourceGrid.GridVirtual.GetScrollRows C# (CSharp) Method

GetScrollRows() protected method

Returns the logical scroll size (usually Rows and Columns) for the specified display area. Returns true if the vertical scrollbar is required Returns true if the horizontal scrollbar is required Calculate the number of rows to scroll. 0 to disable the scrollbar. The returned value is independent from the current scrolling position, must be a fixed value calculated based on the total number of rows and the available area.
protected GetScrollRows ( int displayHeight ) : int
displayHeight int
return int
        protected override int GetScrollRows(int displayHeight)
        {
            int currentHeight = 0;
            int scrollRows = 0;

            //Remove the fixed rows from the scrollable area
            for (int f = 0; f < ActualFixedRows; f++)
                displayHeight -= Rows.GetHeight(f);

            //Calculate the rows to be scrolled
            for (int r = Rows.Count - 1; r >= ActualFixedRows; r--)
            {
                currentHeight += Rows.GetHeight(r);

                if (currentHeight > displayHeight)
                    return Rows.Count - scrollRows;

                scrollRows++;
            }

            return 0;
        }