| You can customize
sizing behaviors when working with derived DataGridView cell, row, and column
types by overriding the DataGridViewCell.GetPreferredSize(), DataGridViewRow.GetPreferredHeight(),
or DataGridViewColumn.GetPreferredWidth() methods or by calling protected
resizing method overloads in a derived DataGridView control. The protected
resizing method overloads are designed to work in pairs to achieve an ideal
cell height-to-width ratio, avoiding overly wide or tall cells. For example, if
you call the AutoResizeRows(DataGridViewAutoSizeRowsMode,Boolean) overload of the
AutoResizeRows method and pass in a value of false for the Boolean parameter,
the overload will calculate the ideal heights and widths for cells in the row,
but it will adjust the row heights only. You must then call the
AutoResizeColumns method to adjust the column widths to the calculated ideal. |