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);
}