DataGridView.RowHeadersBorderStyle 属性

定义

获取或设置行标题单元格的边框样式。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

注解

如果 RowHeadersBorderStyle 属性设置为除 Single 以外的任何内容,则 @no__t 2 属性必须是系统颜色。If 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 方法为应用程序启用了视觉样式,并且 @no__t 属性 @no__t 为-2,则使用当前主题绘制行标题。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. 在这种情况下,对于不应用主题的所有行 @no__t 标题,将忽略 RowHeadersBorderStyle 属性的值。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.

适用于

另请参阅