DataGridViewColumn.MinimumWidth 屬性


取得或設定資料行的最小寬度 (以像素為單位)。Gets or sets the minimum width, in pixels, of the column.

 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.


該值小於 2 或大於 MaxValueThe value is less than 2 or greater than MaxValue.


下列程式碼範例會設定資料行的最小寬度。The following code example sets the minimum width of a column. 這個程式碼範例是針對類別提供之較大範例的一部分 DataGridViewColumnThis 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.