Export (0) Print
Expand All

ToolStripItemCollection Class

Represents a collection of ToolStripItem objects.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[ListBindableAttribute(false)]
[UIPermissionAttribute(SecurityAction.InheritanceDemand, Window = UIPermissionWindow.AllWindows)]
public class ToolStripItemCollection : ArrangedElementCollection, 
	IList, ICollection, IEnumerable

The ToolStripItemCollection type exposes the following members.

  NameDescription
Public methodToolStripItemCollectionInitializes a new instance of the ToolStripItemCollection class with the specified container ToolStrip and the specified array of ToolStripItem controls.
Top

  NameDescription
Public propertyCountGets the number of elements in the collection. (Inherited from ArrangedElementCollection.)
Public propertyIsReadOnlyGets a value indicating whether the ToolStripItemCollection is read-only. (Overrides ArrangedElementCollection.IsReadOnly.)
Public propertyItem[Int32]Gets the item at the specified index.
Public propertyItem[String]Gets the item with the specified name.
Top

  NameDescription
Public methodAdd(Image)Adds a ToolStripItem that displays the specified image to the collection.
Public methodAdd(String)Adds a ToolStripItem that displays the specified text to the collection.
Public methodAdd(ToolStripItem)Adds the specified item to the end of the collection.
Public methodAdd(String, Image)Adds a ToolStripItem that displays the specified image and text to the collection.
Public methodAdd(String, Image, EventHandler)Adds a ToolStripItem that displays the specified image and text to the collection and that raises the Click event.
Public methodAddRange(ToolStripItem[])Adds an array of ToolStripItem controls to the collection.
Public methodAddRange(ToolStripItemCollection)Adds a ToolStripItemCollection to the current collection.
Public methodClearRemoves all items from the collection.
Public methodContainsDetermines whether the specified item is a member of the collection.
Public methodContainsKeyDetermines whether the collection contains an item with the specified key.
Public methodCopyTo(Array, Int32)Copies the entire contents of this collection to a compatible one-dimensional Array, starting at the specified index of the target array. (Inherited from ArrangedElementCollection.)
Public methodCopyTo(ToolStripItem[], Int32)Copies the collection into the specified position of the specified ToolStripItem array.
Public methodEqualsDetermines whether two ArrangedElementCollection instances are equal. (Inherited from ArrangedElementCollection.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFindSearches for items by their name and returns an array of all matching controls.
Public methodGetEnumeratorReturns an enumerator for the entire collection. (Inherited from ArrangedElementCollection.)
Public methodGetHashCodeReturns the hash code for this instance. (Inherited from ArrangedElementCollection.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIndexOfRetrieves the index of the specified item in the collection.
Public methodIndexOfKeyRetrieves the index of the first occurrence of the specified item within the collection.
Public methodInsertInserts the specified item into the collection at the specified index.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemoveRemoves the specified item from the collection.
Public methodRemoveAtRemoves an item from the specified index in the collection.
Public methodRemoveByKeyRemoves the item that has the specified key.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public Extension MethodAsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast<TResult>Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top

  NameDescription
Explicit interface implemetationPrivate propertyICollection.IsSynchronizedFor a description of this member, see the ICollection.IsSynchronized property. (Inherited from ArrangedElementCollection.)
Explicit interface implemetationPrivate propertyICollection.SyncRootFor a description of this member, see the ICollection.SyncRoot property. (Inherited from ArrangedElementCollection.)
Explicit interface implemetationPrivate methodIList.AddAdds an item to the collection.
Explicit interface implemetationPrivate methodIList.ClearRemoves all items from the collection.
Explicit interface implemetationPrivate methodIList.ContainsDetermines if the collection contains a specified item.
Explicit interface implemetationPrivate methodIList.IndexOfDetermines the location of a specified item in the collection.
Explicit interface implemetationPrivate methodIList.InsertInserts an item into the collection at a specified index.
Explicit interface implemetationPrivate propertyIList.IsFixedSizeGets a value indicating whether the collection has a fixed size.
Explicit interface implemetationPrivate propertyIList.ItemRetrieves the element at the specified index.
Explicit interface implemetationPrivate methodIList.RemoveRemoves the first occurrence of a specified item from the collection.
Explicit interface implemetationPrivate methodIList.RemoveAtRemoves an item from the collection at a specified index.
Top

The Add, Remove, and RemoveAt methods enable you to add and remove individual controls from the collection. You can also use the AddRange or Clear methods to add or remove all the controls from the collection.

You can determine whether a ToolStripItem is a member of the collection by passing the control into the Contains method. To get the index value of the location of a ToolStripItem in the collection, pass the control into the IndexOf method. The collection can be copied into an array by calling the CopyTo method.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft