property Items.ItemBackColor(Index as Long) as Color
Retrieves or sets a background color for a specific item.

 TypeDescription 
   Index as Long A long expression that indicates the index of the item. If the Index is -1, the ItemBackColor changes the background color for all items.  
   Color A color expression that indicates the item's foreground color. The last 7 bits in the high significant byte of the color to indicates the identifier of the skin being used. Use the Add method to add new skins to the control. If you need to remove the skin appearance from a part of the control you need to reset the last 7 bits in the high significant byte of the color being applied to the background's part.  

Use the ItemBackColor property to change the item's background color. Use the CellForeColor property to change the cell's foreground color. Use the ItemForeColor property to change the item's foreground color. Use the CellBackColor property to change the cell's background color. Use the ClearItemBackColor property to clear the item's background color when the ItemBackColor property is used. You can use the ItemBackColor property and a skin ( Add method ) to define a different pattern on the item's background, when you need a special marker for the item.

In VB.NET or C# you require the following functions until the .NET framework will provide:

You can use the following VB.NET function:
     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 
You can use the following C# function:
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);
}

The following C# sample changes the background color for the focused item:

axList1.Items.set_ItemBackColor(axList1.Items.FocusItem, ToUInt32(Color.Red) );

The following VB.NET sample changes the background color for the focused item:

With AxList1.Items
    .ItemBackColor(.FocusItem) = ToUInt32(Color.Red)
End With

The following C++ sample changes the background color for the focused item:

#include "Items.h"
CItems items = m_list.GetItems();
items.SetItemBackColor( items.GetFocusItem(), RGB(255,0,0) );

The following VFP sample changes the background color for the focused item:

with thisform.List1.Items
	.ItemBackColor( .FocusItem ) = RGB(255,0,0)
endwith 

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.