This documentation is archived and is not being maintained.

DataGrid.HeaderBackColor Property

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

[Visual Basic]
Public Property HeaderBackColor As Color
public Color HeaderBackColor {get; set;}
public: __property Color get_HeaderBackColor();
public: __property void set_HeaderBackColor(Color);
public function get HeaderBackColor() : Color;
public function set HeaderBackColor(Color);

Property Value

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


Exception Type Condition
ArgumentNullException While trying to set the property, a Color.Empty was passed.


[Visual Basic] The following example sets the background color of column headers using a value passed to the method.

[Visual Basic] 

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

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataGrid Class | DataGrid Members | System.Windows.Forms Namespace | HeaderForeColor | FlatMode