ToolStripItemCollection ToolStripItemCollection ToolStripItemCollection ToolStripItemCollection Class

定义

表示 ToolStripItem 对象集合。Represents a collection of ToolStripItem objects.

public ref class ToolStripItemCollection : System::Windows::Forms::Layout::ArrangedElementCollection, System::Collections::IList
[System.ComponentModel.ListBindable(false)]
public class ToolStripItemCollection : System.Windows.Forms.Layout.ArrangedElementCollection, System.Collections.IList
type ToolStripItemCollection = class
    inherit ArrangedElementCollection
    interface IList
    interface ICollection
    interface IEnumerable
Public Class ToolStripItemCollection
Inherits ArrangedElementCollection
Implements IList
继承
ToolStripItemCollectionToolStripItemCollectionToolStripItemCollectionToolStripItemCollection
属性
实现

注解

AddRemove,和RemoveAt方法,可以添加和从集合中移除单个控件。The Add, Remove, and RemoveAt methods enable you to add and remove individual controls from the collection. 此外可以使用AddRangeClear方法来添加或从集合中移除所有控件。You can also use the AddRange or Clear methods to add or remove all the controls from the collection.

您可以确定是否ToolStripItem是通过将传递到控件集合的成员Contains方法。You can determine whether a ToolStripItem is a member of the collection by passing the control into the Contains method. 若要获取的位置的索引值ToolStripItem在集合中,将传递到控件IndexOf方法。To get the index value of the location of a ToolStripItem in the collection, pass the control into the IndexOf method. 可以将集合复制到一个数组,通过调用CopyTo方法。The collection can be copied into an array by calling the CopyTo method.

构造函数

ToolStripItemCollection(ToolStrip, ToolStripItem[]) ToolStripItemCollection(ToolStrip, ToolStripItem[]) ToolStripItemCollection(ToolStrip, ToolStripItem[]) ToolStripItemCollection(ToolStrip, ToolStripItem[])

初始化的新实例ToolStripItemCollection类使用指定的容器ToolStrip和指定的数组ToolStripItem控件。Initializes a new instance of the ToolStripItemCollection class with the specified container ToolStrip and the specified array of ToolStripItem controls.

属性

Count Count Count Count

获取集合中的元素数。Gets the number of elements in the collection.

(Inherited from ArrangedElementCollection)
ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

有关此成员的说明,请参见 IsSynchronized 属性。For a description of this member, see the IsSynchronized property.

(Inherited from ArrangedElementCollection)
ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

有关此成员的说明,请参见 SyncRoot 属性。For a description of this member, see the SyncRoot property.

(Inherited from ArrangedElementCollection)
IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示 ToolStripItemCollection 是否为只读。Gets a value indicating whether the ToolStripItemCollection is read-only.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取指定索引处的项。Gets the item at the specified index.

Item[String] Item[String] Item[String] Item[String]

获取具有指定名称的项。Gets the item with the specified name.

方法

Add(Image) Add(Image) Add(Image) Add(Image)

添加ToolStripItem,显示指定的图像集合。Adds a ToolStripItem that displays the specified image to the collection.

Add(String) Add(String) Add(String) Add(String)

添加ToolStripItem到集合显示指定的文本。Adds a ToolStripItem that displays the specified text to the collection.

Add(String, Image) Add(String, Image) Add(String, Image) Add(String, Image)

添加ToolStripItem到集合显示在指定的图像和文本。Adds a ToolStripItem that displays the specified image and text to the collection.

Add(String, Image, EventHandler) Add(String, Image, EventHandler) Add(String, Image, EventHandler) Add(String, Image, EventHandler)

将添加ToolStripItem到集合显示在指定的图像和文本,并引发Click事件。Adds a ToolStripItem that displays the specified image and text to the collection and that raises the Click event.

Add(ToolStripItem) Add(ToolStripItem) Add(ToolStripItem) Add(ToolStripItem)

将指定的项添加到集合的末尾。Adds the specified item to the end of the collection.

AddRange(ToolStripItemCollection) AddRange(ToolStripItemCollection) AddRange(ToolStripItemCollection) AddRange(ToolStripItemCollection)

添加ToolStripItemCollection到当前集合。Adds a ToolStripItemCollection to the current collection.

AddRange(ToolStripItem[]) AddRange(ToolStripItem[]) AddRange(ToolStripItem[]) AddRange(ToolStripItem[])

添加一个数组ToolStripItem控件添加到集合。Adds an array of ToolStripItem controls to the collection.

Clear() Clear() Clear() Clear()

从集合中移除所有项。Removes all items from the collection.

Contains(ToolStripItem) Contains(ToolStripItem) Contains(ToolStripItem) Contains(ToolStripItem)

确定指定的项是否为集合的成员。Determines whether the specified item is a member of the collection.

ContainsKey(String) ContainsKey(String) ContainsKey(String) ContainsKey(String)

确定集合是否包含具有指定键的项。Determines whether the collection contains an item with the specified key.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

从目标数组的指定索引处开始将此集合的全部内容复制到兼容的一维 ArrayCopies the entire contents of this collection to a compatible one-dimensional Array, starting at the specified index of the target array.

(Inherited from ArrangedElementCollection)
CopyTo(ToolStripItem[], Int32) CopyTo(ToolStripItem[], Int32) CopyTo(ToolStripItem[], Int32) CopyTo(ToolStripItem[], Int32)

将集合复制到指定的指定位置ToolStripItem数组。Copies the collection into the specified position of the specified ToolStripItem array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定两个 ArrangedElementCollection 实例是否相等。Determines whether two ArrangedElementCollection instances are equal.

(Inherited from ArrangedElementCollection)
Find(String, Boolean) Find(String, Boolean) Find(String, Boolean) Find(String, Boolean)

按名称搜索项并返回所有匹配控件的数组。Searches for items by their name and returns an array of all matching controls.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回一个用于访问整个集合的枚举数。Returns an enumerator for the entire collection.

(Inherited from ArrangedElementCollection)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

(Inherited from ArrangedElementCollection)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
IndexOf(ToolStripItem) IndexOf(ToolStripItem) IndexOf(ToolStripItem) IndexOf(ToolStripItem)

检索集合中指定的项的索引。Retrieves the index of the specified item in the collection.

IndexOfKey(String) IndexOfKey(String) IndexOfKey(String) IndexOfKey(String)

检索指定项在集合中的第一个匹配项的索引。Retrieves the index of the first occurrence of the specified item within the collection.

Insert(Int32, ToolStripItem) Insert(Int32, ToolStripItem) Insert(Int32, ToolStripItem) Insert(Int32, ToolStripItem)

将指定的项插入到集合中的指定索引处。Inserts the specified item into the collection at the specified index.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(ToolStripItem) Remove(ToolStripItem) Remove(ToolStripItem) Remove(ToolStripItem)

从集合中移除指定的项。Removes the specified item from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

从集合中的指定索引中移除的项。Removes an item from the specified index in the collection.

RemoveByKey(String) RemoveByKey(String) RemoveByKey(String) RemoveByKey(String)

移除具有指定的键的项。Removes the item that has the specified key.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

向集合中添加一项。Adds an item to the collection.

IList.Clear() IList.Clear() IList.Clear() IList.Clear()

从集合中移除所有项。Removes all items from the collection.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

确定集合是否包含指定的项。Determines if the collection contains a specified item.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

确定集合中指定项的位置。Determines the location of a specified item in the collection.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

将某个项插入到集合中的指定索引处。Inserts an item into the collection at a specified index.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

获取一个值,该值指示集合是否具有固定大小。Gets a value indicating whether the collection has a fixed size.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

检索位于指定索引处的元素。Retrieves the element at the specified index.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

从集合中移除指定项的第一个匹配项。Removes the first occurrence of a specified item from the collection.

IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32)

从集合中指定索引处移除的项。Removes an item from the collection at a specified index.

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

将转换IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

适用于