Enumerate controls of a form in z-order

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
 
M

MuZZy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top