DataGrid.AlternatingBackColor Property

Definition

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

public:
 property System::Drawing::Color AlternatingBackColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public System.Drawing.Color AlternatingBackColor { get; set; }
member this.AlternatingBackColor : System.Drawing.Color with get, set
Public Property AlternatingBackColor As Color

Property Value

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

Examples

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
   

Remarks

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.

Applies to