Redigera

Dela via


ListViewItem.ListViewSubItemCollection.AddRange Method

Definition

Adds an array of subitems to the collection.

Overloads

AddRange(String[])

Creates new subitems based on an array and adds them to the collection.

AddRange(ListViewItem+ListViewSubItem[])

Adds an array of ListViewItem.ListViewSubItem objects to the collection.

AddRange(String[], Color, Color, Font)

Creates new subitems based on an array and adds them to the collection with specified foreground color, background color, and font.

AddRange(String[])

Creates new subitems based on an array and adds them to the collection.

public:
 void AddRange(cli::array <System::String ^> ^ items);
public:
 void AddRange(... cli::array <System::String ^> ^ items);
public void AddRange (string[] items);
public void AddRange (params string[] items);
member this.AddRange : string[] -> unit
Public Sub AddRange (items As String())
Public Sub AddRange (ParamArray items As String())

Parameters

items
String[]

An array of strings representing the text of each subitem to add to the collection.

Remarks

You can use this version of the AddRange method to add an array of strings to the collection, where each string in the collection represents the text of a new subitem. You can use the other version of the AddRange method that accepts an array of strings as a parameter to specify the foreground color, background color, and font for each item being added. If you want to reuse existing ListViewItem.ListViewSubItem objects and add them to the collection, you can use the version of the AddRange method that accepts an array of ListViewItem.ListViewSubItem objects as a parameter.

If you want to add a single ListViewItem.ListViewSubItem, use the Add method. You can also use the Insert method if you want to add a single ListViewItem.ListViewSubItem at a specific position in the collection.

See also

Applies to

AddRange(ListViewItem+ListViewSubItem[])

Adds an array of ListViewItem.ListViewSubItem objects to the collection.

public:
 void AddRange(cli::array <System::Windows::Forms::ListViewItem::ListViewSubItem ^> ^ items);
public:
 void AddRange(... cli::array <System::Windows::Forms::ListViewItem::ListViewSubItem ^> ^ items);
public void AddRange (System.Windows.Forms.ListViewItem.ListViewSubItem[] items);
public void AddRange (params System.Windows.Forms.ListViewItem.ListViewSubItem[] items);
member this.AddRange : System.Windows.Forms.ListViewItem.ListViewSubItem[] -> unit
Public Sub AddRange (items As ListViewItem.ListViewSubItem())
Public Sub AddRange (ParamArray items As ListViewItem.ListViewSubItem())

Parameters

items
ListViewItem.ListViewSubItem[]

An array of ListViewItem.ListViewSubItem objects to add to the collection.

Remarks

You can use this method to reuse the subitems stored in a different ListViewItem. If you want to add a single ListViewItem.ListViewSubItem object, use the Add method. You can also use the Insert method if you want to add a single ListViewItem.ListViewSubItem at a specific position in the collection.

See also

Applies to

AddRange(String[], Color, Color, Font)

Creates new subitems based on an array and adds them to the collection with specified foreground color, background color, and font.

public:
 void AddRange(cli::array <System::String ^> ^ items, System::Drawing::Color foreColor, System::Drawing::Color backColor, System::Drawing::Font ^ font);
public void AddRange (string[] items, System.Drawing.Color foreColor, System.Drawing.Color backColor, System.Drawing.Font font);
member this.AddRange : string[] * System.Drawing.Color * System.Drawing.Color * System.Drawing.Font -> unit
Public Sub AddRange (items As String(), foreColor As Color, backColor As Color, font As Font)

Parameters

items
String[]

An array of strings representing the text of each subitem to add to the collection.

foreColor
Color

A Color that represents the foreground color of the subitem.

backColor
Color

A Color that represents the background color of the subitem.

font
Font

A Font that represents the typeface to display the subitem's text in.

Remarks

You can use this version of the AddRange method to add an array of strings to the collection, where each string in the collection represents the text of a new subitem. In addition, this version of the AddRange method allows you to specify the foreground color, background color, and font for each subitem. You can use the other version of the AddRange method that accepts an array of strings as a parameter if you do not want to specify foreground color, background color, and font settings for each subitem. If you want to reuse existing ListViewItem.ListViewSubItem objects and add them to the collection, you can use the version of the AddRange method that accepts an array of ListViewItem.ListViewSubItem objects as a parameter.

If you want to add a single ListViewItem.ListViewSubItem, use the Add method. You can also use the Insert method if you want to add a single ListViewItem.ListViewSubItem at a specific position in the collection.

Note

By default, subitems use the foreground color, background color, and font specified for the parent item. Set the ListViewItem.UseItemStyleForSubItems property to false to prevent the parent item styles from overriding the subitem styles.

See also

Applies to