ToolStripItemCollection 類別

定義

表示 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
繼承
ToolStripItemCollection
屬性
實作

備註

Add、和方法RemoveAt可讓您新增和移除集合中的個別控制項。 RemoveThe 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[])

使用指定的容器 (Container) ToolStripItemCollection 和指定的 ToolStrip 控制項陣列,初始化 ToolStripItem 類別的新執行個體。Initializes a new instance of the ToolStripItemCollection class with the specified container ToolStrip and the specified array of ToolStripItem controls.

屬性

Count

取得集合中的項目數。Gets the number of elements in the collection.

(繼承來源 ArrangedElementCollection)
IsReadOnly

取得值,指出 ToolStripItemCollection 是否唯讀。Gets a value indicating whether the ToolStripItemCollection is read-only.

Item[Int32]

取得位於指定索引處的項目。Gets the item at the specified index.

Item[String]

取得具有指定名稱的項目。Gets the item with the specified name.

方法

Add(Image)

將顯示指定影像的 ToolStripItem 加入集合中。Adds a ToolStripItem that displays the specified image to the collection.

Add(String)

將顯示指定文字的 ToolStripItem 加入集合中。Adds a ToolStripItem that displays the specified text to the collection.

Add(String, Image)

將顯示指定影像和文字的 ToolStripItem 加入集合中。Adds a ToolStripItem that displays the specified image and text to the collection.

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)

將指定的項目加入至集合的尾端。Adds the specified item to the end of the collection.

AddRange(ToolStripItem[])

ToolStripItem 控制項陣列加入集合中。Adds an array of ToolStripItem controls to the collection.

AddRange(ToolStripItemCollection)

ToolStripItemCollection 加入目前的集合中。Adds a ToolStripItemCollection to the current collection.

Clear()

移除集合的所有項目。Removes all items from the collection.

Contains(ToolStripItem)

判斷指定項目是否為集合的成員。Determines whether the specified item is a member of the collection.

ContainsKey(String)

判斷集合是否包含具有指定索引鍵的項目。Determines whether the collection contains an item with the specified key.

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.

(繼承來源 ArrangedElementCollection)
CopyTo(ToolStripItem[], Int32)

將集合複製到指定之 ToolStripItem 陣列的指定位置中。Copies the collection into the specified position of the specified ToolStripItem array.

Equals(Object)

判斷兩個 ArrangedElementCollection 執行個體是否相等。Determines whether two ArrangedElementCollection instances are equal.

(繼承來源 ArrangedElementCollection)
Find(String, Boolean)

根據名稱搜尋項目,並傳回所有相符控制項的陣列。Searches for items by their name and returns an array of all matching controls.

GetEnumerator()

傳回整個集合的列舉值。Returns an enumerator for the entire collection.

(繼承來源 ArrangedElementCollection)
GetHashCode()

傳回這個執行個體的雜湊碼。Returns the hash code for this instance.

(繼承來源 ArrangedElementCollection)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(ToolStripItem)

擷取集合中指定之項目的索引。Retrieves the index of the specified item in the collection.

IndexOfKey(String)

擷取指定之項目在集合中第一次出現的索引。Retrieves the index of the first occurrence of the specified item within the collection.

Insert(Int32, ToolStripItem)

將指定的項目插入至集合中的指定索引處。Inserts the specified item into the collection at the specified index.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(ToolStripItem)

從集合中移除指定的項目。Removes the specified item from the collection.

RemoveAt(Int32)

從集合中指定的索引處移除項目。Removes an item from the specified index in the collection.

RemoveByKey(String)

移除具有指定索引鍵的項目。Removes the item that has the specified key.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

ICollection.IsSynchronized

如需這個成員的描述,請參閱 IsSynchronized 屬性。For a description of this member, see the IsSynchronized property.

(繼承來源 ArrangedElementCollection)
ICollection.SyncRoot

如需這個成員的描述,請參閱 SyncRoot 屬性。For a description of this member, see the SyncRoot property.

(繼承來源 ArrangedElementCollection)
IList.Add(Object)

將項目加入至集合。Adds an item to the collection.

IList.Clear()

移除集合的所有項目。Removes all items from the collection.

IList.Contains(Object)

判斷集合是否含有指定的項目。Determines if the collection contains a specified item.

IList.IndexOf(Object)

判斷指定之項目在集合中的位置。Determines the location of a specified item in the collection.

IList.Insert(Int32, Object)

在指定的索引位置,插入項目至集合之中。Inserts an item into the collection at a specified index.

IList.IsFixedSize

取得值,這個值表示集合的大小是否是固定的。Gets a value indicating whether the collection has a fixed size.

IList.Item[Int32]

擷取指定索引處的項目。Retrieves the element at the specified index.

IList.Remove(Object)

移除集合中第一個出現的指定項目。Removes the first occurrence of a specified item from the collection.

IList.RemoveAt(Int32)

從指定索引的集合移除項目。Removes an item from the collection at a specified index.

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於