Control.ControlCollection.IndexOf(Control) 方法

定義

擷取控制項集合中指定之控制項的索引。

public:
 int IndexOf(System::Windows::Forms::Control ^ control);
public int IndexOf (System.Windows.Forms.Control control);
public int IndexOf (System.Windows.Forms.Control? control);
member this.IndexOf : System.Windows.Forms.Control -> int
Public Function IndexOf (control As Control) As Integer

參數

control
Control

要在集合中尋找的 Control

傳回

Int32

以零起始的索引值,表示指定的 ControlControl.ControlCollection 中的位置。

備註

如果在集合中找不到控制項,方法 IndexOf 傳回值為 -1。

適用於