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

GetAutoColumnWidth() private method

Returns the minimum column width that will show all the columns contents. Returns 0 if the column width should not be changed, due to the resize mode.
private GetAutoColumnWidth ( int column ) : int
column int
return int
        private int GetAutoColumnWidth(int column)
        {
            RowCollection rows = this.TableModel.Rows;
            int maxwidth = 0;
            Column c = this.ColumnModel.Columns[column];

            if (this.includeHeaderInAutoWidth)
            {
                maxwidth = c.ContentWidth;
            }

            for (int i = 0; i < rows.Count; i++)
            {
                // Don't count this row if it is currently a hidden subrow
                Row row = rows[i];
                if ((row.Parent == null || row.Parent.ExpandSubRows) && (row.Cells.Count > column))
                {
                    int w = row.Cells[column].ContentWidth;
                    if (w > maxwidth)
                        maxwidth = w;
                }
            }

            int changedMax = GetAutoColumnWidthWithMode(c, maxwidth);
            return changedMax;
        }
Table