DataGridViewCellBorderStyle 枚举

定义

指定可以应用于 DataGridView 控件的单元格的边框样式。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
继承
DataGridViewCellBorderStyle

字段

Custom 0

已经自定义的边框。A border that has been customized.

None 4

无边框。No borders.

Raised 2

三维凸起边框。A three-dimensional raised border.

RaisedHorizontal 9

水平三维凸起边框。A horizontal three-dimensional raised border.

RaisedVertical 6

垂直三维凸起边框。A vertical three-dimensional raised border.

Single 1

单行边框。A single line border.

SingleHorizontal 8

水平单行边框。A horizontal single-line border.

SingleVertical 5

垂直单行边框。A vertical single-line border.

Sunken 3

三维凹陷边框。A three-dimensional sunken border.

SunkenHorizontal 10

水平三维凹陷边框。A horizontal three-dimensional sunken border.

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 =
        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

注解

DataGridView控件CellBorderStyle的属性使用DataGridViewCellBorderStyle枚举。The CellBorderStyle property of the DataGridView control uses the DataGridViewCellBorderStyle enumeration. 若要在行之间仅绘制边框, 请指定 SingleHorizontal、SunkenHorizontal 或 RaisedHorizontal。To draw borders only between the rows, specify SingleHorizontal, SunkenHorizontal or RaisedHorizontal. 若要仅在列之间绘制边框, 请指定 SingleVertical、SunkenVertical 或 RaisedVertical。To draw borders only between the columns, specify SingleVertical, SunkenVertical or RaisedVertical. 若要在行和列之间绘制边框, 请指定 SingleSunken 或凸起。To draw borders between the rows and columns, specify SingleSunken or Raised.

适用于

另请参阅