Control.ControlCollection.SetChildIndex(Control, Int32) 方法

定义

将集合中的指定子控件的索引设置为指定的索引值。

C#
public void SetChildIndex (System.Windows.Forms.Control child, int newIndex);
C#
public virtual void SetChildIndex (System.Windows.Forms.Control child, int newIndex);

参数

child
Control

要搜索的 child 控件。

newIndex
Int32

控件的新索引值。

例外

child 控件不在 Control.ControlCollection 中。

注解

调用时SetChildIndex,参数引用child的引用将移动到指定newIndex的位置,并将重新排序中的Control.ControlCollection其他Control引用以适应移动。Control 索引值为零的控件位于 z 顺序的顶部,数字越接近底部。

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

另请参阅