NativeExcel for .Net Developer's Reference

IPalette.Item Property

Gets or sets colors in the palette. The palette has 56 entries, each represented by an System.Color value.

[C#] In C#, this property is the indexer for the IPalette class.

[Visual Basic]
DefaultPropertyItem(_
ByValIndexAsInteger_
)AsColor
[C#]
Colorthis[
intIndex
]{get;set;}
[C++]
__propertyColorget_Item(
intIndex
);
__propertyvoidset_Item(
intIndex,
ColornewValue
);
[JScript]
returnValue = IPaletteObject.Item( Index );
IPaletteObject.Item( Index ) = newValue;
-or-
returnValue = IPaletteObject( Index );
IPaletteObject( Index ) = newValue;

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.

Parameters

Index
Integer. The color number (from 1 to 56).

Example

This example sets color six in the color palette for the workbook.

[C#]
book.Colors[6] = System.Drawing.Color.FromArgb(200, 100, 100);
[VisualBasic]
book.Colors(6) = System.Drawing.Color.FromArgb(200, 100, 100)
[C++]
book->Colors->Item[6] = System::Drawing::Color::FromArgb(200, 100, 100);

See Also

IPalette Interface | NativeExcel Namespace | Colors Property