System.Windows.Forms.DataGridColumnStyle.GetPreferredSize Method

When overridden in a derived class, gets the width and height of the specified value. The width and height are used when the user navigates to System.Windows.Forms.DataGridTableStyle using the System.Windows.Forms.DataGridColumnStyle.

Syntax

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

Parameters

g
A System.Drawing.Graphics object.
value
An object value for which you want to know the screen height and width.

Returns

A System.Drawing.Size that contains the dimensions of the cell.

Remarks

Use DataGridColumnStyle.GetPreferredSize(System.Drawing.Graphics, object) to determine the width a column should resize to, given a particular string or numeral.

Requirements

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