System.Windows.Forms.DataGridBoolColumn.GetPreferredSize Method

Gets the optimum width and height of a cell given a specific value to contain.

Syntax

protected override System.Drawing.Size GetPreferredSize (System.Drawing.Graphics g, object value)

Parameters

g
A System.Drawing.Graphics that draws the cell.
value
The value that must fit in the cell.

Returns

A System.Drawing.Size that contains the drawing information for the cell.

Remarks

The DataGridBoolColumn.GetPreferredSize(System.Drawing.Graphics, object) method allows you to resize the column based on the value displayed. For example, if a cell contains an especially large value, you can use the DataGridBoolColumn.GetPreferredSize(System.Drawing.Graphics, object) method to return the optimum size of the cell based on the value. The optimum size takes into account not only the size of the string, but also the font used to display it.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0