property Items.CellBackColor(Index as Long, ColIndex as Variant) as Color
Retrieves or sets the cell's background color.

 TypeDescription 
   Index as Long A long expression that indicates the index of the item. If the Index is -1, the ClearItemBackColor clears the background color for all items.  
   ColIndex as Variant A long expression that indicates the column's index, or a string expression that indicates the column's caption or column's key.  
   Color A color expression that indicates the cell's background 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 CellBackColor property to set the cell's background color. Use the ItemBackColor property to change the item's background color. If the CellBackColor and CellForeColor were not used, the cell uses the control's background color, retrieved by the BackColor property. Use the CellForeColor property to change the cell's foreground color. Use the ClearCellBackColor property to clear the cell's background color when CellBackColor property was used. Use the Def(exCellBackColor) property to specify the background color for all cells in a column. You can use the CellBackColor property and the Add method to specify a different pattern on the cell's background. 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 following VB sample changes the cell's visual appearance. The sample uses the "" skin to mark a cell:

With List1
    With .VisualAppearance
        .Add &H40, App.Path + "\cell.ebn"
    End With
    With .Items
        .CellBackColor(.FirstVisibleItem, 0) = &H40000000
    End With
End With

The following C++ sample changes the cell's appearance:

#include "Appearance.h"
#include "Items.h"
m_list.GetVisualAppearance().Add( 0x40, COleVariant(_T("D:\\Temp\\ExList.Help\\cell.ebn")) );
m_list.GetItems().SetCellBackColor( COleVariant( m_list.GetItems().GetFirstVisibleItem() ), COleVariant( long(0) ), 0x40000000 );

The following VB.NET sample changes the cell's appearance.

With AxList1
    With .VisualAppearance
        .Add(&H40, "D:\Temp\ExList.Help\cell.ebn")
    End With
    With .Items
        .CellBackColor(.FirstVisibleItem, 0) = &H40000000
    End With
End With

The following C# sample changes the cell's appearance.

axList1.VisualAppearance.Add(0x40, "D:\\Temp\\ExList.Help\\cell.ebn");
axList1.Items.set_CellBackColor(axList1.Items.FirstVisibleItem, 0, 0x40000000);

The following VFP sample changes the cell's appearance.

With thisform.List1
    With .VisualAppearance
        .Add(64, "D:\Temp\ExList.Help\cell.ebn")
    EndWith
    with .Items
    	.DefaultItem = .FirstVisibleItem
    	.CellBackColor(0,0) = 1073741824
    endwith
EndWith

 


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