This documentation is archived and is not being maintained.

DataGridViewColumn.DividerWidth Property

Note: This property is new in the .NET Framework version 2.0.

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 */
public int get_DividerWidth ()

/** @property */
public void set_DividerWidth (int value)

public function get DividerWidth () : int

public function set DividerWidth (value : int)

Property Value

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;
}

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0
Show: