Example #1
0
        ///  <summary>
        /// [email protected]: To find if the specified column is hidden under the fixedColumn
        ///  </summary>
        /// <param name="column"></param>
        /// <param name="includePartial">True - partially hidden col will also be treated as hidden</param>
        /// <returns></returns>
        public bool IsColumnHiddenUnderFixedColumn(int column, bool includePartial)
        {
            int actualFixedColumns = m_Grid.ActualFixedColumns;

            if (column < actualFixedColumns || column >= m_Grid.Columns.Count)
            {
                return(false);
            }

            int fixedRight = m_Grid.GetFixedAreaWidth();
            int left       = m_Grid.Columns.GetLeft(column);
            int right      = left + m_Grid.Columns.GetWidth(column);

            return(IsColumnHiddenUnderFixedColumn(fixedRight, left, right, column, includePartial));
        }
Example #2
0
        public Rectangle RangeToVisibleRectangle(Range range)
        {
            if (range.IsEmpty())
            {
                return(Rectangle.Empty);
            }
            if (range.Start.Column < 0)
            {
                throw new ArgumentOutOfRangeException(string.Format("range.Start.Column was less than zero: {0}", range.Start.Column));
            }
            if (range.Start.Row < 0)
            {
                throw new ArgumentOutOfRangeException(string.Format("range.Start.Row was less than zero: {0}", range.Start.Row));
            }

            int firstRow = FindFirstVisibleRowFromRange(range);

            if (firstRow < 0)
            {
                return(Rectangle.Empty);
            }

            int actualFixedRows = m_Grid.ActualFixedRows;

            int actualFixedColumns = m_Grid.ActualFixedColumns;

            int y = m_Grid.Rows.GetTop(firstRow);

            if (m_Grid.IsRowHiddenUnderFixedRows(firstRow, true))
            {
                y = m_Grid.GetFixedAreaHeight();
            }

            int firstColumn = FindFirstVisibleColumnFromRange(range);

            if (firstColumn < 0)
            {
                return(Rectangle.Empty);
            }

            int x = m_Grid.Columns.GetLeft(firstColumn);

            if (IsColumnHiddenUnderFixedColumn(firstColumn, true))
            {
                x = m_Grid.GetFixedAreaWidth();
            }

            int lastColumn = range.End.Column;

            if (range.End.Column != actualFixedColumns - 1 && m_Grid.IsColumnHiddenUnderFixedColumn(range.End.Column))
            {
                lastColumn = actualFixedColumns - 1;
            }
            int width = m_Grid.Columns.GetRight(lastColumn) - x;

            int lastRow = range.End.Row;

            if (range.End.Row != actualFixedRows - 1 && m_Grid.IsRowHiddenUnderFixedRows(range.End.Row))
            {
                lastRow = actualFixedRows - 1;
            }
            int height = m_Grid.Rows.GetBottom(lastRow) - y;

            Size size = new Size(width, height);

            if (size.IsEmpty)
            {
                return(Rectangle.Empty);
            }

            return(new Rectangle(new Point(x, y), size));
        }