Control.ControlCollection.IndexOf(Control) Control.ControlCollection.IndexOf(Control) Control.ControlCollection.IndexOf(Control) Method

定义

检索控件集合中指定控件的索引。Retrieves the index of the specified control in the control collection.

public:
 int IndexOf(System::Windows::Forms::Control ^ control);
public int IndexOf (System.Windows.Forms.Control control);
member this.IndexOf : System.Windows.Forms.Control -> int

参数

control
Control Control Control

要在集合中查找的 ControlThe Control to locate in the collection.

返回

一个从零开始的索引值,它表示 Control 中的指定 Control.ControlCollection 的位置。A zero-based index value that represents the position of the specified Control in the Control.ControlCollection.

注解

如果在集合中找不到该控件, 则IndexOf方法返回值为-1。If the control is not found in the collection, the IndexOf method return value is -1.

适用于