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

定义

将集合中的指定子控件的索引设置为指定的索引值。Sets the index of the specified child control in the collection to the specified index value.

public:
 void SetChildIndex(System::Windows::Forms::Control ^ child, int newIndex);
public void SetChildIndex (System.Windows.Forms.Control child, int newIndex);
member this.SetChildIndex : System.Windows.Forms.Control * int -> unit
Public Sub SetChildIndex (child As Control, newIndex As Integer)

参数

child
Control

要搜索的 childControlThe childControl to search for.

newIndex
Int32

控件的新索引值。The new index value of the control.

异常

child 控件不在 Control.ControlCollection 中。The child control is not in the Control.ControlCollection.

注解

调用 SetChildIndex 时,child 参数所引用的 @no__t 将移到 newIndex 指定的位置,而 @no__t 中的其他 Control 引用将重新排序以容纳移动。When SetChildIndex is called, the Control referred to by the child parameter is moved to the position specified by newIndex and the other Control references in the Control.ControlCollection are reordered to accommodate the move. 索引值为零的控件位于 z 顺序的顶部,较大的数字更接近底部。The control with an index value of zero is at the top of the z-order, and higher numbers are closer to the bottom.

适用于

另请参阅