Bearbeiten

Freigeben über


DataGridView.RowHeadersBorderStyle Property

Definition

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; }
[<System.ComponentModel.Browsable(true)>]
member this.RowHeadersBorderStyle : System.Windows.Forms.DataGridViewHeaderBorderStyle with get, set
Public Property RowHeadersBorderStyle As DataGridViewHeaderBorderStyle

Property Value

One of the DataGridViewHeaderBorderStyle values.

Attributes

Exceptions

The specified value when setting this property is not a valid DataGridViewHeaderBorderStyle value.

The specified value when setting this property is Custom.

Examples

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

Remarks

If the RowHeadersBorderStyle property is set to anything other than Single, the GridColor property must be a system color.

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.

Note

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

Applies to

See also