DataGridViewColumn.DividerWidth 屬性


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

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



分割線 (資料行的右邊界) 的粗細 (以像素為單位)。The thickness, in pixels, of the divider (the column's right margin).


下列程式碼範例會在第三個數據行之後加入垂直邊緣。The following code example adds a vertical edge after the third column. 這個程式碼範例是針對類別提供之較大範例的一部分 DataGridViewColumnThis code example is part of a larger example provided for the DataGridViewColumn class.

// Set the vertical edge.
void Button7_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   int thirdColumn = 2;
   //        int edgeThickness = 5;
   DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ];
   column->DividerWidth = 10;

// Set the vertical edge.
private void Button7_Click(object sender,
    System.EventArgs e)
    int thirdColumn = 2;
    DataGridViewColumn column =
    column.DividerWidth = 10;
' Set the vertical edge.
Private Sub Button7_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button7.Click

    Dim thirdColumn As Integer = 2
    Dim column As DataGridViewColumn = _
    column.DividerWidth = 10

End Sub


在可滾動的凍結資料行和資料行之間提供視覺界限時,這個屬性很有用。This property is useful to provide a visual boundary between frozen columns and columns that can scroll. 額外的邊緣是目前資料行的一部分,不過它會採用相關聯的前景色彩 DataGridViewThe extra edge is part of the current column, although it will take on the foreground color of the associated DataGridView. 額外的邊緣不會擴充使用者可以按兩下以自動調整資料行大小的區域。The extra edge does not extend the area in which users can double-click to automatically resize a column. 若要調整資料行的大小,使用者必須按兩下分割和相鄰資料行之間的界限。To resize a column, the user must double-click on the boundary between the divider and the adjacent column.