DataGrid.HeaderBackColor Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the background color of all row and column headers.

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

public Color HeaderBackColor { get; set; }

Property Value

Type: System.Drawing.Color

A Color that represents the background color of row and column headers. The default is the system color for controls, Control.

Exception Condition

While trying to set the property, a Color.Empty was passed.

The following code example sets the background color of column headers using a value passed to the method.

Private Sub SetHeaderBackClr(Byval myGrid As DataGrid)
   myGrid.HeaderBackColor = System.Drawing.Color.CadetBlue
End Sub

.NET Framework
Available since 1.1
Return to top