Version

GetPreferredSize(Graphics,DataGridViewCellStyle,Int32,Size) Method

Calculates the preferred size, in pixels, of the cell.
Syntax
'Declaration
 
Protected Overrides Function GetPreferredSize( _
   ByVal graphics As Graphics, _
   ByVal cellStyle As DataGridViewCellStyle, _
   ByVal rowIndex As Integer, _
   ByVal constraintSize As Size _
) As Size
protected override Size GetPreferredSize( 
   Graphics graphics,
   DataGridViewCellStyle cellStyle,
   int rowIndex,
   Size constraintSize
)

Parameters

graphics
Graphics object used for measurements
cellStyle
Style for the cell
rowIndex
The zero-based row index of the cell.
constraintSize
The cell's maximum allowable size.

Return Value

A System.Drawing.Size that represents the preferred size, in pixels, of the cell.
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also