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

适用于