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

注解

如果RowHeadersBorderStyle属性设置为Single,则GridColor属性必须是一种系统颜色。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方法和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.

适用于

另请参阅