DataGridViewColumnHeaderCell::GetPreferredSize Method (Graphics^, DataGridViewCellStyle^, Int32, Size)

 

Calculates the preferred size, in pixels, of the cell.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

protected:
virtual Size GetPreferredSize(
	Graphics^ graphics,
	DataGridViewCellStyle^ cellStyle,
	int rowIndex,
	Size constraintSize
) override

Parameters

graphics
Type: System.Drawing::Graphics^

The Graphics used to draw the cell.

cellStyle
Type: System.Windows.Forms::DataGridViewCellStyle^

A DataGridViewCellStyle that represents the style of the cell.

rowIndex
Type: System::Int32

The zero-based row index of the cell.

constraintSize
Type: System.Drawing::Size

The cell's maximum allowable size.

Return Value

Type: System.Drawing::Size

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

Exception Condition
ArgumentOutOfRangeException

rowIndex is not -1.

.NET Framework
Available since 2.0
Return to top
Show: