DataGridViewCellBorderStyle DataGridViewCellBorderStyle DataGridViewCellBorderStyle DataGridViewCellBorderStyle Enum


Specifies the border styles that can be applied to the cells of a DataGridView control.

public enum class DataGridViewCellBorderStyle
public enum DataGridViewCellBorderStyle
type DataGridViewCellBorderStyle = 
Public Enum DataGridViewCellBorderStyle


Custom Custom Custom Custom 0

A border that has been customized.

None None None None 4

No borders.

Raised Raised Raised Raised 2

A three-dimensional raised border.

RaisedHorizontal RaisedHorizontal RaisedHorizontal RaisedHorizontal 9

A horizontal three-dimensional raised border.

RaisedVertical RaisedVertical RaisedVertical RaisedVertical 6

A vertical three-dimensional raised border.

Single Single Single Single 1

A single line border.

SingleHorizontal SingleHorizontal SingleHorizontal SingleHorizontal 8

A horizontal single-line border.

SingleVertical SingleVertical SingleVertical SingleVertical 5

A vertical single-line border.

Sunken Sunken Sunken Sunken 3

A three-dimensional sunken border.

SunkenHorizontal SunkenHorizontal SunkenHorizontal SunkenHorizontal 10

A horizontal three-dimensional sunken border.

SunkenVertical SunkenVertical SunkenVertical SunkenVertical 7

A vertical three-dimensional sunken border.


The following code example illustrates the use of this type.

private void SetBorderAndGridlineStyles()
    this.dataGridView1.GridColor = Color.BlueViolet;
    this.dataGridView1.BorderStyle = BorderStyle.Fixed3D;
    this.dataGridView1.CellBorderStyle =
    this.dataGridView1.RowHeadersBorderStyle =
    this.dataGridView1.ColumnHeadersBorderStyle =
Private Sub SetBorderAndGridlineStyles()

    With Me.dataGridView1
        .GridColor = Color.BlueViolet
        .BorderStyle = BorderStyle.Fixed3D
        .CellBorderStyle = DataGridViewCellBorderStyle.None
        .RowHeadersBorderStyle = _
        .ColumnHeadersBorderStyle = _
    End With

End Sub


The CellBorderStyle property of the DataGridView control uses the DataGridViewCellBorderStyle enumeration. To draw borders only between the rows, specify SingleHorizontal, SunkenHorizontal or RaisedHorizontal. To draw borders only between the columns, specify SingleVertical, SunkenVertical or RaisedVertical. To draw borders between the rows and columns, specify SingleSunken or Raised.

Applies to

See also