Export (0) Print
Expand All

DataGridViewColumn.DividerWidth Property

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

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public int DividerWidth { get; set; }

Property Value

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

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.

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.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft