Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGridTableStyle.PreferredRowHeight Property

Gets or sets the height used to create a row when a new grid is displayed.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[LocalizableAttribute(true)] 
public int PreferredRowHeight { get; set; }
/** @property */
public int get_PreferredRowHeight ()

/** @property */
public void set_PreferredRowHeight (int value)

public function get PreferredRowHeight () : int

public function set PreferredRowHeight (value : int)

Not applicable.

Property Value

The height of a row, in pixels.

The preferred height is the minimum height needed to accommodate the displayed text with the assigned HeaderFont. A row will not be created with a height less than the specified value. If the font size requires it, however, the row height may be greater than the specified value.

The following code example demonstrates the use of this member.

int myPreferredRowHeight=Convert.ToInt32(myTextBox.Text.Trim());
if(myPreferredRowHeight<18 || myPreferredRowHeight >134)
{
   MessageBox.Show("Enter the height between 18 and 134");
   return;
}
// Set the 'PreferredRowHeight' property of DataGridTableStyle instance.
myTableStyle.PreferredRowHeight=myPreferredRowHeight;
// Add the DataGridTableStyle instance to the GridTableStylesCollection. 
myDataGrid.TableStyles.Add(myTableStyle);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

Show: