DataGridViewRow.MinimumHeight 属性


获取或设置行的最小高度。Gets or sets the minimum height of the row.

 property int MinimumHeight { int get(); void set(int value); };
public int MinimumHeight { get; set; }
member this.MinimumHeight : int with get, set
Public Property MinimumHeight As Integer


行的最小高度(以像素为单位),范围是从 2 到 MaxValueThe minimum row height in pixels, ranging from 2 to MaxValue. 默认值为 3。The default is 3.



DataGridView 控件中的共享行设置了此属性。When setting this property, the row is in a DataGridView control and is a shared row.

设置此属性时,指定的值小于 2。The specified value when setting this property is less than 2.


下面的代码示例使用 MinimumHeight 属性设置第二行的最小高度。The following code example uses the MinimumHeight property to set the minimum height of the second row. 此代码示例摘自 如何执行以下操作:操作 Windows 窗体 DataGridView 控件中的行This code example is part of a larger code example provided in How to: Manipulate Rows in the Windows Forms DataGridView Control.

// Set minimum height.
void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   int secondRow = 1;
   DataGridViewRow^ row = dataGridView->Rows[ secondRow ];
   row->MinimumHeight = 40;

// Set minimum height.
private void Button4_Click(object sender, System.EventArgs e)

    int secondRow = 1;
    DataGridViewRow row = dataGridView.Rows[secondRow];
    row.MinimumHeight = 40;
' Set minimum height.
Private Sub Button4_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button4.Click

    Dim secondRow As Integer = 1
    Dim row As DataGridViewRow = dataGridView.Rows(secondRow)
    row.MinimumHeight = 40
End Sub


MinimumHeight 属性通过将限制设置为用户可通过用户界面(UI)调整行高度的距离,来维护行的显示。The MinimumHeight property maintains the display of the row by setting a limit to how far the user can resize the row's height through the user interface (UI).