DataGridViewColumn.MinimumWidth DataGridViewColumn.MinimumWidth DataGridViewColumn.MinimumWidth DataGridViewColumn.MinimumWidth Property

定义

获取或设置列的最小宽度(以像素为单位)。Gets or sets the minimum width, in pixels, of the column.

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

属性值

像素数(从 2 到 MaxValue),指定了该列的最小宽度。The number of pixels, from 2 to MaxValue, that specifies the minimum width of the column. 默认值为 5。The default is 5.

异常

示例

下面的代码示例设置列的最小宽度。The following code example sets the minimum width of a column. 此代码示例是为DataGridViewColumn类提供的更大示例的一部分。This code example is part of a larger example provided for the DataGridViewColumn class.

//Set the minimum width.
void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   DataGridViewColumn^ column = dataGridView->Columns[ 1 ];
   column->MinimumWidth = 40;
}


//Set the minimum width.
private void Button4_Click(object sender,
    System.EventArgs e)
{
    DataGridViewColumn column = dataGridView.Columns[1];
    column.MinimumWidth = 40;
}
'Set the minimum width.
Private Sub Button4_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button4.Click

    Dim column As DataGridViewColumn = dataGridView.Columns(1)
    column.MinimumWidth = 40
End Sub

注解

MinimumWidth属性设置对在用户界面 (UI) 中调整列大小的限制。The MinimumWidth property sets a limit on how narrow the column can be resized in the user interface (UI). Width属性可以MinimumWidth重写属性。The Width property can override the MinimumWidth property.

适用于

另请参阅