XPTable.Models.Table.CellRect C# (CSharp) Method

CellRect() public method

Returns a Rectangle that specifies the size and location the cell at the specified row and column indexes in client coordinates
public CellRect ( int row, int column ) : Rectangle
row int The index of the row that contains the cell
column int The index of the column that contains the cell
return System.Drawing.Rectangle
        public Rectangle CellRect(int row, int column)
        {
            // return null if the row or column don't exist
            if (row == -1 || row >= this.TableModel.Rows.Count || column == -1 || column >= this.TableModel.Rows[row].Cells.Count)
                return Rectangle.Empty;

            Rectangle columnRect = this.ColumnHeaderRect(column); // Only the Width and X are used - we don't need to work out the Height or Y

            if (columnRect == Rectangle.Empty)
                return columnRect;

            Rectangle rowRect = this.RowRect(row);

            if (rowRect == Rectangle.Empty)
                return rowRect;

            int width = columnRect.Width;
            Cell thisCell = this.TableModel[row, column];
            if (thisCell != null && thisCell.ColSpan > 1)
            {
                width = this.GetColumnWidth(column, thisCell);
            }

            return new Rectangle(columnRect.X, rowRect.Y, width, rowRect.Height);
        }

Same methods

Table::CellRect ( Cell cell ) : Rectangle
Table::CellRect ( XPTable.Models.CellPos cellPos ) : Rectangle
Table