DataGridViewCell::GetPreferredSize Method (Graphics^, DataGridViewCellStyle^, Int32, Size)
.NET Framework (current version)
Calculates the preferred size, in pixels, of the cell.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
protected: virtual Size GetPreferredSize( Graphics^ graphics, DataGridViewCellStyle^ cellStyle, int rowIndex, Size constraintSize )
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::SizeA Size that represents the preferred size, in pixels, of the cell.
The GetPreferredSize method in the base class DataGridViewCell always returns a Size with a width and height of -1. However, this method is overridden in the derived cell classes to return proper values.
.NET Framework
Available since 2.0
Available since 2.0
Show: