Control.ControlCollection.GetChildIndex 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得控制集合中控制項的索引。
多載
| 名稱 | Description |
|---|---|
| GetChildIndex(Control) |
取得控制集合中指定子控制項的索引。 |
| GetChildIndex(Control, Boolean) |
擷取控制集合中指定子控制項的索引,若指定控制項不在控制集合內,則可選擇性地提出例外。 |
GetChildIndex(Control)
取得控制集合中指定子控制項的索引。
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.ControlCollection。
備註
指標為零的控制點位於 z 階的頂端,較高的數字則較接近底部。
另請參閱
適用於
GetChildIndex(Control, Boolean)
擷取控制集合中指定子控制項的索引,若指定控制項不在控制集合內,則可選擇性地提出例外。
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
參數
- throwException
- Boolean
true若參數中Control指定的不是child控制Control.ControlCollection項,則拋出例外;否則,。 false
傳回
一個以零為基礎的索引值,代表指定子控制在控制集合中的位置;否則 -1 若指定內容 Control 不在 Control.ControlCollection中。
例外狀況
不child屬於 ,且Control參數值為 Control.ControlCollection。throwExceptiontrue
備註
指標為零的控制點位於 z 階的頂端,較高的數字則較接近底部。 只有當參數 throwException 為 false時,回傳值為 -1 才會回傳。