Пример #1
0
        /// <summary>Scroll the sheet to the right one column.</summary>
        public void ScrollRight()
        {
            // Get the right most fully visible column.
            var rightColumnIndex = FullyVisibleColumnIndexes.Last();

            // Calculate the new right most column index.
            var newRightColumnIndex = Math.Min(rightColumnIndex + 1, DataProvider.ColumnCount - 1);

            NumberHiddenColumns = CalculateNumberOfHiddenColumnsToMakeColumnVisible(newRightColumnIndex);
        }
Пример #2
0
        /// <summary>Calculate the number of hidden columns to make a column visible.</summary>
        /// <param name="columnIndex"></param>
        private int CalculateNumberOfHiddenColumnsToMakeColumnVisible(int columnIndex)
        {
            int savedNumberHiddenColumns = NumberHiddenColumns;

            // Keep incrementing the number of hidden columns until the column
            // is fully visible.
            NumberHiddenColumns = 0;
            while (NumberHiddenColumns < DataProvider.ColumnCount - 1 && !FullyVisibleColumnIndexes.Contains(columnIndex))
            {
                NumberHiddenColumns++;
            }

            if (NumberHiddenColumns == DataProvider.ColumnCount - 1)
            {
                NumberHiddenColumns = savedNumberHiddenColumns + 1; // No hidden columns as there isn't room to display any.
                NumberFrozenColumns = 0;
            }

            int returnColumnNumber = NumberHiddenColumns;

            NumberHiddenColumns = savedNumberHiddenColumns;
            return(returnColumnNumber);
        }