DataGridTableStyle.PreferredRowHeight Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the height used to create a row when a new grid is displayed.
public:
property int PreferredRowHeight { int get(); void set(int value); };
public int PreferredRowHeight { get; set; }
member this.PreferredRowHeight : int with get, set
Public Property PreferredRowHeight As Integer
Property Value
The height of a row, in pixels.
Examples
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 );
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);
Dim myPreferredRowHeight As Integer = Convert.ToInt32(myTextBox.Text.Trim())
If myPreferredRowHeight < 18 Or myPreferredRowHeight > 134 Then
MessageBox.Show("Enter the height between 18 and 134")
Return
End If
' Set the 'PreferredRowHeight' property of DataGridTableStyle instance.
myTableStyle.PreferredRowHeight = myPreferredRowHeight
' Add the DataGridTableStyle instance to the GridTableStylesCollection.
myDataGrid.TableStyles.Add(myTableStyle)
Remarks
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.
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om