private static int[] AllocatedColumnWidths(Size[,] allocation, int rowIndex)
{
int[] colWidths = new int[] { 0, 0, 0 };
for (int col = 0; col < 3; col++)
{
if (rowIndex == -1)
{
for (int row = 0; row < 3; row++)
{
// Store the widest cell in each column
if (allocation[col, row].Width > colWidths[col])
colWidths[col] = allocation[col, row].Width;
}
}
else
{
// Store the widest cell in each column
if (allocation[col, rowIndex].Width > colWidths[col])
colWidths[col] = allocation[col, rowIndex].Width;
}
}
return colWidths;
}