I have a container control (a Panel
) that has a number of Forms
loaded into it. Based on user interaction, I .BringToFront()
certain forms. However, in other parts of the program, I would like to figure out which form is currently in front. (In other words, determine which was the last form to have its .BringToFront()
method called.)
我有一个容器控件(Panel),其中加载了许多表单。基于用户交互,我.BringToFront()某些形式。但是,在程序的其他部分,我想弄清楚当前在哪个表单中。 (换句话说,确定哪个是调用其.BringToFront()方法的最后一种形式。)
What's the best way to go about determining which control is in front?
确定哪种控制在前面的最佳方法是什么?
1 个解决方案
#1
You can use the GetChildIndex
method of the Controls collection to get the index of a particular child control.
您可以使用Controls集合的GetChildIndex方法来获取特定子控件的索引。
this.Controls.GetChildIndex(myControl);
The highest value is on top.
最高值位于顶部。
#1
You can use the GetChildIndex
method of the Controls collection to get the index of a particular child control.
您可以使用Controls集合的GetChildIndex方法来获取特定子控件的索引。
this.Controls.GetChildIndex(myControl);
The highest value is on top.
最高值位于顶部。