Forum Discussion

EvgenyKamyshev's avatar
15 years ago

Z-Order of WinFormsObject

Hi 



I have a problem with TopMost identification of WinFormsObject controls under the same WinForm.

I want to know z-order of controls to identify who is OnTheTop, if I have intersection between controls.



Thanks,

Evgeny

1 Reply


  • Hi Evgeny,





    A z-order of controls in a Windows Forms application is actually the order of these controls in their parent's Controls collection. You can get an index of a control using the GetChildIndex method of the Controls collection:



      var form = Sys.Process("MyApp").WinFormsObject("MyForm");

      Log.Message(form.Controls.GetChildIndex(form.WinFormsObject("MyPanel")));






    The topmost control has index 0.