语言

Control.ControlCollection.GetChildIndex 方法

定义

检索控件集合中控件的索引。

重载

名称 说明
GetChildIndex(Control)

检索控件集合中指定子控件的索引。

GetChildIndex(Control, Boolean)

检索控件集合中指定子控件的索引,如果指定的控件不在控件集合中,可以选择引发异常。

GetChildIndex(Control)

Source:
Control.ControlCollection.cs
Source:
Control.ControlCollection.cs
Source:
Control.ControlCollection.cs
Source:
Control.ControlCollection.cs
Source:
Control.ControlCollection.cs

检索控件集合中指定子控件的索引。

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

参数

child
Control

在 Control 控件集合中搜索的项。

返回

一个从零开始的索引值,表示控件集合中指定子控件的位置。

例外

注解

索引值为零的控件位于 z 顺序的顶部,数字越接近底部。

另请参阅

适用于

GetChildIndex(Control, Boolean)

Source:
Control.ControlCollection.cs
Source:
Control.ControlCollection.cs
Source:
Control.ControlCollection.cs
Source:
Control.ControlCollection.cs
Source:
Control.ControlCollection.cs

检索控件集合中指定子控件的索引,如果指定的控件不在控件集合中,可以选择引发异常。

public:
 int GetChildIndex(System::Windows::Forms::Control ^ child, bool throwException);
public:
 virtual int GetChildIndex(System::Windows::Forms::Control ^ child, bool throwException);
public int GetChildIndex(System.Windows.Forms.Control child, bool throwException);
public virtual int GetChildIndex(System.Windows.Forms.Control child, bool throwException);
member this.GetChildIndex : System.Windows.Forms.Control * bool -> int
abstract member GetChildIndex : System.Windows.Forms.Control * bool -> int
override this.GetChildIndex : System.Windows.Forms.Control * bool -> int
Public Function GetChildIndex (child As Control, throwException As Boolean) As Integer
Public Overridable Function GetChildIndex (child As Control, throwException As Boolean) As Integer

参数

child
Control

在 Control 控件集合中搜索的项。

throwException
Boolean

true 如果 Control 参数中指定的 child 不是控件, Control.ControlCollection则为 ;否则为 false。

返回

一个从零开始的索引值,表示控件集合中指定子控件的位置;否则 -1 如果未在 .. 中Control找到指定的Control.ControlCollection值,

例外

参数childControl值Control.ControlCollection不在throwException内。true

注解

索引值为零的控件位于 z 顺序的顶部,数字越接近底部。 仅当参数为throwException时,才会返回 -1 的false返回值。

另请参阅

适用于