Z Order of controls?

Ö

Özden Irmak

Hello,

Let's say I have 3 button controls over each other on a form and I want to
define their Z Orders. Anybody knows a way?

Thanks,

Özden
 
M

Mark Broadbent

yes simple, use the send to back or bring to front on each to change their
z-order.

Br,

Mark.
 
J

Joey Callisay

form.SetChildIndex method sets the index of the control in the forms control
collection. control.SendToBack and control.BringToFront also alters their
index in the control collection
 
Ö

Özden Irmak

So does this mean that when a controls Z-Order is changed, it's position in
Controls collection does also change am I right?

Let's say when I loop through the Controls collection in the standart way,
I'll get the controls from back to front or maybe from front to back?

Regards,

Özden
 
Ö

Özden Irmak

Hi Mark,

There is a misunderstanding, I want to get the Z Orders of the controls, not
set...

Regards,,

Özden
 
H

Herfried K. Wagner [MVP]

Özden Irmak said:
Let's say I have 3 button controls over each other on
a form and I want to define their Z Orders. Anybody
knows a way?

At design time, choose "Send To Back"/"Bring To Front" from the control's
context menu, at runtime call the control's 'SendToBack'/'BringToFront'
method.
 
Ö

Özden Irmak

Hello Herfired,

I do not want to set the Z Order, I want to get it...

Regards,

Özden
 
M

Mick Doherty

Özden Irmak said:
Hello Herfired,

I do not want to set the Z Order, I want to get it...
You did say that you wanted to define the zOrder...

To get their zOrder use:
Controls.GetChildIndex(ButtonX)
 
Ö

Özden Irmak

Thanks for the answer...

I've used the wrong word while asking the question, sorry for that...

Thanks again,

Özden

"Mick Doherty"
 

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