LegendItemsCollection.Add Method

Definition

Adds a custom LegendItem object to the end of the collection.

Overloads

Add(Color, String)

Adds a custom LegendItem object to the end of the collection.

Add(String, String)

Adds a custom LegendItem object with the specified image to the end of the collection.

Add(Color, String)

Adds a custom LegendItem object to the end of the collection.

C#
public int Add(System.Drawing.Color color, string text);

Parameters

color
Color

The symbol color of the legend item.

text
String

The legend item text.

Returns

An integer that represents the location in the zero-based index where the item was inserted into the collection.

Remarks

Appends a custom legend item with the specified text and symbol color to the end of the collection.

To add a custom legend item that uses an image for its symbol, call the Add(String, String) method.

To insert a custom LegendItem into the collection, use one of the Insert methods of this class.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Add(String, String)

Adds a custom LegendItem object with the specified image to the end of the collection.

C#
public int Add(string image, string text);

Parameters

image
String

The absolute or relative URL of the image file to be used for the legend item symbol.

text
String

The legend item text.

Returns

An integer that represents the location in the zero-based index where the item was inserted into the collection.

Remarks

Appends a custom legend item to the collection with the specified text and image to be used as the symbol for the legend item.

To add a custom legend item that uses a color for its symbol, call the Add(Color, String) method.

To insert a LegendItem object into the collection use one of the Insert methods of this class.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1