Enumerate controls of a form in z-order

  • Thread starter Thread starter MuZZy
  • Start date Start date
M

MuZZy

Hi,
I need to build a function which would return all controls which are upper in z-order relatively to
given control. I need this in order to be able to temporary bring the control to front
(Control.BringToFront()) and being able to place it back later in the original order.

Any suggestions are highly appreciated!

Thank you
Andrey
 
MuZZy said:
Hi,
I need to build a function which would return all controls which are
upper in z-order relatively to given control. I need this in order to be
able to temporary bring the control to front (Control.BringToFront())
and being able to place it back later in the original order.

Any suggestions are highly appreciated!

Thank you
Andrey

Ok, by playing with a form and two buttons i actually found the way to enumerate controls on a
container - they are odered in the same sequence as added to Controls array of container.

if we have:

form.Controls.Add(button1);
form.Controls.Add(button2);

then button1 will be the top control on the form.
 
Back
Top