Edit

Bagikan melalui


DataGridViewCellBorderStyle Enum

Definition

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
Inheritance
DataGridViewCellBorderStyle

Fields

Name Value Description
Custom 0

A border that has been customized.

Single 1

A single line border.

Raised 2

A three-dimensional raised border.

Sunken 3

A three-dimensional sunken border.

None 4

No borders.

SingleVertical 5

A vertical single-line border.

RaisedVertical 6

A vertical three-dimensional raised border.

SunkenVertical 7

A vertical three-dimensional sunken border.

SingleHorizontal 8

A horizontal single-line border.

RaisedHorizontal 9

A horizontal three-dimensional raised border.

SunkenHorizontal 10

A horizontal three-dimensional sunken border.

Examples

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 =
        DataGridViewCellBorderStyle.None;
    this.dataGridView1.RowHeadersBorderStyle =
        DataGridViewHeaderBorderStyle.Single;
    this.dataGridView1.ColumnHeadersBorderStyle =
        DataGridViewHeaderBorderStyle.Single;
}
Private Sub SetBorderAndGridlineStyles()

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

End Sub

Remarks

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