Control.ControlCollection.SetChildIndex(Control, Int32) Control.ControlCollection.SetChildIndex(Control, Int32) Control.ControlCollection.SetChildIndex(Control, Int32) Control.ControlCollection.SetChildIndex(Control, Int32) Method

定义

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

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

参数

child
Control Control Control Control

要搜索的 childControlThe childControl to search for.

newIndex
Int32 Int32 Int32 Int32

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

异常

注解

调用SetChildIndexControl , Control 参数所child引用的会移动到Control.ControlCollection指定的位置,而中的其他引用将重新排序newIndex以容纳移动。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.

适用于

另请参阅