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 以外的任何專案,則 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. 在此情況下,除了不會套用主題的 TopLeftHeaderCell 以外,所有資料列標頭都會忽略 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.

適用於

另請參閱