Gets or sets a value indicating how row heights are determined.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
This property lets you configure the control so that row heights are automatically adjusted to fit their contents whenever the contents change. If WrapMode is enabled, row heights are also adjusted whenever column widths change. Some sizing modes let you limit the size adjustment to the currently displayed rows in order to increase performance.
Only rows with a Visible property value of true are resized automatically, and changing the visibility of a row does not cause resizing to occur. Additionally, when rows are set to automatically resize, the user cannot adjust the row heights with the mouse.
The Height value of an automatically sized row is recalculated during layout to account for the size of the font that is used. To get the correct Height, you should retrieve the value in the form's Layout event instead of in the form's constructor.
For more information about content-based automatic sizing, see Sizing Options in the Windows Forms DataGridView Control.
The following code example demonstrates how to set the row to automatically resize based on the contents of the row headers and all of the columns. This code example is part of a larger example provided in How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)