SourceGrid.GridVirtual.GetScrollColumns C# (CSharp) Méthode

GetScrollColumns() protected méthode

Calculate the number of columns 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 columns and the available area.
protected GetScrollColumns ( int displayWidth ) : int
displayWidth int
Résultat int
        protected override int GetScrollColumns(int displayWidth)
        {
            int currentWidth = 0;
            int scrollCols = 0;

            //Remove the fixed columns from the scrollable area
            for (int f = 0; f < ActualFixedColumns; f++)
                displayWidth -= Columns.GetWidth(f);

            //Calculate the columns to be scrolled
            for (int c = Columns.Count - 1; c >= ActualFixedColumns; c--)
            {
                currentWidth += Columns.GetWidth(c);

                if (currentWidth > displayWidth)
                    return Columns.Count - scrollCols;

                scrollCols++;
            }

            return 0;
        }