property Items.ItemBackColor(Item as HITEM) as Color

Retrieves or sets a background color for a specific item.

 TypeDescription 
   Item as HITEM A long expression that indicates the handle of the item. If the Item is 0, the ItemBackColor changes the background color for all items.  
   Color A color expression that indicates the item's background color.  

The ItemBackColor property specifies the background or the visual appearance for the item's background on the columns/item section. Use the CellBackColor property to change the cell's background color. To change the background color of the entire control you can call BackColor property of the control. Use the ClearItemBackColor property to clear the item's background color, after setting using the ItemBackColor property. Use the ConditionalFormats method to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula. The ItemBackColor property of the Chart object specifies the item's background or visual appearance for the chart area. 

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:

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

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

With AxGantt1.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_gantt.GetItems();
items.SetItemBackColor( items.GetFocusItem(), RGB(255,0,0) );

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

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

Use the following VB sample changes the background color for the cells in the first column, when adding new items:

Private Sub Gantt1_AddItem(ByVal Item As EXGANTTLibCtl.HITEM)
    Gantt1.Items.CellBackColor(Item, o) = vbBlue
End Sub

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