DataGridView.RowHeadersBorderStyle DataGridView.RowHeadersBorderStyle DataGridView.RowHeadersBorderStyle DataGridView.RowHeadersBorderStyle Property

定义

获取或设置行标题单元格的边框样式。Gets or sets the border style of the row header cells.

public:
 property System::Windows::Forms::DataGridViewHeaderBorderStyle RowHeadersBorderStyle { System::Windows::Forms::DataGridViewHeaderBorderStyle get(); void set(System::Windows::Forms::DataGridViewHeaderBorderStyle value); };
[System.ComponentModel.Browsable(true)]
public System.Windows.Forms.DataGridViewHeaderBorderStyle RowHeadersBorderStyle { get; set; }
member this.RowHeadersBorderStyle : System.Windows.Forms.DataGridViewHeaderBorderStyle with get, set
Public Property RowHeadersBorderStyle As DataGridViewHeaderBorderStyle

属性值

异常

当设置此属性时,指定的值不是有效的 DataGridViewHeaderBorderStyle 值。The specified value when setting this property is not a valid DataGridViewHeaderBorderStyle value.

当设置此属性时,指定的值为 CustomThe specified value when setting this property is Custom.

示例

下面的代码示例演示如何使用此属性。The following code example illustrates the use of this property.

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

注解

如果将Single GridColor属性设置为以外的任何内容,则属性必须是系统颜色。 RowHeadersBorderStyleIf the RowHeadersBorderStyle property is set to anything other than Single, the GridColor property must be a system color.

不能将此属性设置为Custom值,这是一个只读值,指示边框样式已通过使用AdvancedRowHeadersBorderStyle属性进行自定义。You cannot set this property to the Custom value, which is a read-only value indicating that the border style has been customized through the use of the AdvancedRowHeadersBorderStyle property.

备注

如果通过Application.EnableVisualStyles方法为应用程序启用了视觉样式, EnableHeadersVisualStyles并且属性为true,则使用当前主题绘制行标题。If visual styles are enabled for the application through the Application.EnableVisualStyles method and the EnableHeadersVisualStyles property is true, the row headers are painted using the current theme. 在这种情况下,对于不RowHeadersBorderStyle应用主题的所有行标题TopLeftHeaderCell,将忽略属性的值。In this case, the value of the RowHeadersBorderStyle property is ignored for all row headers except the TopLeftHeaderCell, to which the theme is not applied.

适用于

另请参阅