Exemplo n.º 1
0
        ///  <summary>
        /// [email protected]: To find if the specified row is hidden under the fixedRow
        ///  </summary>
        /// <param name="rowIndex"></param>
        /// <param name="includePartial">True - partially hidden row will also be treated as hidden</param>
        /// <returns></returns>
        public bool IsRowHiddenUnderFixedRows(int rowIndex, bool includePartial)
        {
            int actualFixedRows = m_Grid.ActualFixedRows;

            if (rowIndex < actualFixedRows || rowIndex >= m_Grid.Rows.Count)
            {
                return(false);
            }

            int fixedBottom = m_Grid.GetFixedAreaHeight();
            int top         = m_Grid.Rows.GetTop(rowIndex);
            int bottom      = top + m_Grid.Rows.GetHeight(rowIndex);

            return(IsRowHiddenUnderFixedRows(fixedBottom, top, bottom, rowIndex, includePartial));
        }
Exemplo n.º 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));
        }