DataGridViewCellBorderStyle DataGridViewCellBorderStyle DataGridViewCellBorderStyle DataGridViewCellBorderStyle Enum

定义

指定可以应用于 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
继承
DataGridViewCellBorderStyleDataGridViewCellBorderStyleDataGridViewCellBorderStyleDataGridViewCellBorderStyle

字段

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

注解

CellBorderStyle的属性DataGridView控件使用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.

适用于

另请参阅