Share via


ToolboxItemCollection.Contains(ToolboxItem) 方法

定義

指出集合是否包含指定的 ToolboxItem

public:
 bool Contains(System::Drawing::Design::ToolboxItem ^ value);
public bool Contains (System.Drawing.Design.ToolboxItem value);
member this.Contains : System.Drawing.Design.ToolboxItem -> bool
Public Function Contains (value As ToolboxItem) As Boolean

參數

value
ToolboxItem

搜尋集合所要找的 ToolboxItem

傳回

如果集合包含指定的物件,則為 true,否則為 false

範例

下列程式代碼範例示範如何使用 ContainsToolboxItemCollection方法。

// If the collection contains the specified ToolboxItem, 
// retrieve the collection index of the specified item.
int indx = -1;
if ( collection->Contains( item ) )
   indx = collection->IndexOf( item );
// If the collection contains the specified ToolboxItem, 
// retrieve the collection index of the specified item.
int indx = -1;
if( collection.Contains( item ) )
    indx = collection.IndexOf( item );
' If the collection contains the specified ToolboxItem, 
' retrieve the collection index of the specified item.
Dim indx As Integer = -1
If collection.Contains(item) Then
    indx = collection.IndexOf(item)
End If

適用於