DataGridView.ColumnHeadersBorderStyle Property

 

Gets the border style applied to the column headers.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[<BrowsableAttribute(true)>]
member ColumnHeadersBorderStyle : DataGridViewHeaderBorderStyle with get, set

Exception Condition
InvalidEnumArgumentException

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

ArgumentException

The specified value when setting this property is Custom.

If the ColumnHeadersBorderStyle 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 AdvancedColumnHeadersBorderStyle property.

System_CAPS_noteNote

If visual styles are enabled for the application through the Application.EnableVisualStyles method and the EnableHeadersVisualStyles property is true, the column headers are painted using the current theme. In this case, the value of the ColumnHeadersBorderStyle property is ignored for all column headers except the TopLeftHeaderCell, to which the theme is not applied.

The following code example demonstrates how to set the ColumnHeadersDefaultCellStyle, AutoSizeRowsMode, ColumnHeadersBorderStyle, CellBorderStyle, GridColor, BackgroundColor, RowHeadersVisible, SelectionMode, ColumnCount, and MultiSelect properties. In addition, the code example demonstrates how to set the DataGridViewColumn.Name and DataGridViewColumn.DefaultCellStyle properties. To run this example, paste the code into a form that contains a DataGridView nameddataGridView1, and then call the SetUpDataGridView method from the form's constructor or Load event handler. Ensure all events are associated with their event handlers.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: