property Grid.BackColorAlternate as Color
Specifies the background color used to display alternate items in the control.

TypeDescription
Color A color expression that indicates the alternate background color. If the first byte of four is 7F, the color is applied to the items section only. For instance, a value of 0x7F0000FF indicates that the BackColorAlternate property is red, and it applied to the items section only, so the non-items section is not painted.

By default, the control's BackColorAlternate property is zero. Use the BackColorAlternate property to specify the background color used to display alternate items in the control. The control ignores the BackColorAlternate property if it is 0 ( zero ). Use the BackColor property to specify the control's background color. Use the SelBackColor property to specify the selection background color. Use the ItemBackColor property to specify the item's background color. Use the CellBackColor property to specify the cell's background color. Use the Def(exCellBackColor) property to specify the background color for all cells in the column. If the first two bytes of the BackColorAlternate property are 0x7F, the non-items area is not filled.

For instance, the following VB sample draws alternate rows, including the non-items area:

Grid1.BackColorAlternate = RGB(255, 190, 190)

 

The following VB sample draws alternate rows, excluding the non-items area:

Grid1.BackColorAlternate = &H7F000000 Or RGB(255, 190, 190)

The following VB.NET sample draws alternate rows, excluding the non-items area:

Dim sRGB As UInt32 = &H7F000000 Or ToUInt32(ControlPaint.LightLight(Color.Lavender))
AxGrid1.Template = "BackColorAlternate = " + sRGB.ToString()

or use the BackColorAlternate32 property provided by the /NET assembly version

where the ToUInt32 method converts a Color expression to a unsigned integer:

Shared Function ToUInt32(ByVal c As Color) As UInt32
    Dim i As Long
    i = c.R
    i = i + 256 * c.G
    i = i + 256 * 256 * c.B
    ToUInt32 = Convert.ToUInt32(i)
End Function

The following C# sample draws alternate rows, excluding the non-items area:

UInt32 sRGB = 0x7F000000 | ToUInt32( ControlPaint .LightLight(Color.Lavender) );
axGrid1.Template = "BackColorAlternate = " + sRGB.ToString();

where the ToUInt32 method converts a Color expression to a unsigned integer.

private UInt32 ToUInt32(Color c)
{
	long i;
	i = c.R;
	i = i + 256 * c.G;
	i = i + 256 * 256 * c.B;
	return Convert.ToUInt32(i);