试一试GetChildIndex Control.ControlCollection.GetChildIndex Method (Control) public int GetChildIndex( Control child ) Retrieves the index of the specified child control within the control collection. The control with an index value of zero is at the top of the z-order, and higher numbers are closer to the bottom.应该在form中执行 Controls.GetChildIndex就可以
测试了下,没有问题 private void button1_Click_1(object sender, EventArgs e) { int res1 = Controls.GetChildIndex(axWebBrowser1); //我这里结果是0 int res2 = Controls.GetChildIndex(webBrowser1); //我这里结果是2 }
public int GetChildIndex(
Control child
)
Retrieves the index of the specified child control within the control collection. The control with an index value of zero is at the top of the z-order, and higher numbers are closer to the bottom.应该在form中执行 Controls.GetChildIndex就可以
private void button1_Click_1(object sender, EventArgs e)
{
int res1 = Controls.GetChildIndex(axWebBrowser1); //我这里结果是0
int res2 = Controls.GetChildIndex(webBrowser1); //我这里结果是2
}