Retrieves or sets a background color for a specific item.
Type | Description | |||
Item as HITEM | A long expression that indicates the item's handle. | |||
Color | A color expression that indicates the item's background color. |
The following VB sample changes the item's appearance. The sample uses the "".
With Grid1 With .VisualAppearance .Add &H50, App.Path + "\item.ebn" End With With .Items .ItemBackColor(.FirstVisibleItem) = &H50000000 End With End With
The following C++ sample changes the item's appearance:
#include "Appearance.h" #include "Items.h" m_grid.GetVisualAppearance().Add( 0x50, COleVariant(_T("D:\\Temp\\ExGrid.Help\\item.ebn")) ); m_grid.GetItems().SetItemBackColor( m_grid.GetItems().GetFirstVisibleItem() , 0x50000000 );
The following VB.NET sample changes the item's appearance:
With AxGrid1 With .VisualAppearance .Add(&H50, "D:\Temp\ExGrid.Help\item.ebn") End With With .Items .ItemBackColor(.FirstVisibleItem) = &H50000000 End With End With
The following C# sample changes the item's appearance:
axGrid1.VisualAppearance.Add(0x50, "D:\\Temp\\ExGrid.Help\\item.ebn"); axGrid1.Items.set_ItemBackColor(axGrid1.Items.FirstVisibleItem, 0x50000000);
The following VFP sample changes the item's appearance:
With thisform.Grid1 With .VisualAppearance .Add(80, "D:\Temp\ExGrid.Help\item.ebn") EndWith with .Items .DefaultItem = .FirstVisibleItem .ItemBackColor(0) = 1342177280 endwith EndWith
where the 1342177280 value represents the 0x50000000 hexa value.
In VB.NET or C# you require the following functions until the .NET framework will provide:
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
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:
axGrid1.Items.set_ItemBackColor(axGrid1.Items.FocusItem, ToUInt32(Color.Red) );
The following VB.NET sample changes the background color for the focused item:
With AxGrid1.Items .ItemBackColor(.FocusItem) = ToUInt32(Color.Red) End With
The following VB sample changes the background color for the focused item:
With Grid1.Items .ItemBackColor(.FocusItem) = vbRed End With
The following C++ sample changes the background color for the focused item:
#include "Items.h" CItems items = m_grid.GetItems(); items.SetItemBackColor( items.GetFocusItem(), RGB(255,0,0) );
The following VFP sample changes the background color for the focused item:
with thisform.Grid1.Items .DefaultItem = .FocusItem .ItemBackColor( 0 ) = RGB(255,0,0) endwith
Use the following VB sample to change the background color for the first column when adding new items:
Private Sub Grid1_AddItem(ByVal Item As EXGRIDLibCtl.HITEM) Grid1.Items.CellBackColor(Item, o) = vbBlue End Sub