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]
Default Property Item( _ 
   ByVal Index As Integer _ 
) As Color
[C#]
Color this[
   int Index
] { get; set; }
[C++]
__property Color get_Item(
   int Index
);
__property void set_Item(
   int Index,
   Color newValue
);
[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);
[Visual Basic]
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