这个方法MSDN上的解释是这样的:
调用 SetChildIndex 时,将把 child 参数所引用的 Control 移动到 newIndex 指定的位置,并将重新调整 Control..::.ControlCollection 中的其他 Control 引用的顺序以适应此次移动。 索引值为零的控件位于 Z-顺序的顶部,数字越大距底部越近。我的理解的是设置控件索引为0时就会将控件置顶,那如果我连接几个控件设置索引为0,如:
this.Controls.SetChildIndex(this.txtName,0);
this.Controls.SetChildIndex(this.cmdOk,0);
this.Controls.SetChildIndex(this.cmdCancel,0);
this.Controls.SetChildIndex(this.dgvResu,0);以这样的顺序排列下来,哪个控件是最置顶的,还是一样的?还有,MSDN上的这句话是什么意思?"索引值为零的控件位于 Z-顺序的顶部,"