System.Windows.Forms.DataGridTextBoxColumn.GetPreferredSize Method

Returns the optimum width and height of the cell in a specified row relative to the specified value.

Syntax

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

Parameters

g
A System.Drawing.Graphics object used to draw shapes on the screen.
value
The value to draw.

Returns

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

Remarks

The optimum width and height is calculated by measuring the string size, taking into account its font and attributes, and adding margin values.

Requirements

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