DataGrid.AlternatingBackColor Property

 

Gets or sets the background color of odd-numbered rows of the grid.

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

public Color AlternatingBackColor { get; set; }

Property Value

Type: System.Drawing.Color

A Color that represents the alternating background color. The default is the system color for windows (Window).

By default, both the BackColor and the AlternatingBackColor properties are set to the same color. Setting the BackColor property affects only even-numbered rows, while setting the AlternatingBackColor affects only odd-numbered rows.

The following code example sets the AlternatingBackColor to a Color value.

Private Sub ChangeAltBackClr(ByVal myGrid As DataGrid, _
    ByVal myColor As Color)
    myGrid.AlternatingBackColor = myColor
End Sub

.NET Framework
Available since 1.1
Return to top
Show: