public Cell GetContainingCell(Control control)
{
if (control.Parent != this)
throw new ArgumentException("Control is not part of this table.", "control");
Point p = control.Location;
CellPos cellPos = new CellPos(this.RowIndexAt(p), this.ColumnIndexAt(p));
if (this.IsValidCell(cellPos))
{
// Adjust this to take colspan into account
// LastMouseCell may be a cell that is 'under' a colspan cell
CellPos realCell = this.ResolveColspan(cellPos);
Cell cell = tableModel[realCell];
return cell;
}
return null;
}