DataGridViewColumn.DividerWidth Property

Definition

Gets or sets the width, in pixels, of the column divider.

C#
public int DividerWidth { get; set; }

Property Value

The thickness, in pixels, of the divider (the column's right margin).

Examples

The following code example adds a vertical edge after the third column. This code example is part of a larger example provided for the DataGridViewColumn class.

C#
// Set the vertical edge.
private void Button7_Click(object sender,
    System.EventArgs e)
{
    int thirdColumn = 2;
    DataGridViewColumn column =
        dataGridView.Columns[thirdColumn];
    column.DividerWidth = 10;
}

Remarks

This property is useful to provide a visual boundary between frozen columns and columns that can scroll. The 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.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also