Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Z-Order

 

If I have a number of overlapping controls on a Windows form, how can I programmatically change the z-order? I need to change the order in which they are layered. Not just BringToFront or SendToBack but set them in a specific order.

 

Thanks!

  • 5 months later...
Posted

:confused: I'm having the same dilema... this is one more thing to join the VB6 good methods that just desapeared with no clear explanation... If anyone knows a work around this help us.

 

Thanks

Software bugs are impossible to detect by anybody except the end user.
  • *Experts*
Posted

First off, this thread is REALLY old - you might as well create a new one with a question.

 

Second, why not use the BringToFront, SendToBack methods?

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Hi...

 

I didn't notice the "age" of the thread... sorry...

 

Why not use the BringToFront & SentToBack?

If you have 2 objects it works fine but if you have 3 or more objects and want the object on top to go behind the the next lower object you can't... if you use the SendToBack method it goes behind all lower objects in z-order...

 

Get it?

 

 

;) Hope anyone knows how to fix this ...!!!

 

 

Thanx

Software bugs are impossible to detect by anybody except the end user.
  • *Experts*
Posted

I can't really picture what you're doing - I mean, I can, but I can't imagine why you'd want this. You have 3 (or more) controls on top of each other? If all 3+ are the exact same size, I'd think you'd only want one visible at a time (easy enough to fix). If you really have 3+ controls the same place, but different sizes... well it seems like it would be confusing (overlapping controls that pop in front/behind other controls)... maybe I'm missing it.

 

Unfortunately, I know of no built-in .net way to do what you want (SendBackOneZ or something similar). It may be similar the "insert a new tab at position x" problem. Meaning, you can't do it directly but have to reorder all the controls calling SendToFront for each of them, in order.

 

You might also look at the Win API to see if that is something that's built in. You might be able to make the call that way and save some time.

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Thanks for the ideas but the API call is out of the deal because it wold put my project on an unmanaged level and I rather leaving this out...

 

The only thing that might help is the brigToFront on the right order on all objects but it will bring too much CPU overhead.

 

And a good question is... If the method exists in VB6 (ZOrder) why did it desapear in .net??? If they put it there war because they found it usefull!! Am I thinking wrong?

 

Well, I'll explain where this problem messes with my head and maybe you guys have a much better way to do it...

 

I've been developing apps in VB since later VB5 and since then the MDI form never filled my needs... Now, with all this real OOP language capability I decided to build my own MDI class that controls the MDI it self, all its windows childs and the way they apear, behave with the MDI resize, modify the MDI background to support the background color and the one that is missing that is a modal MDIChild!

 

The only way I can figure out to do this is having a way to manage ZOrder os the forms! I can simply use the BringToFront but if, for example, I have 3 forms (F1,F2 & F3) F2 is modal of F1 and I select F3 the ZOrder wold be F3,F2 & F1... With BringToFront Method I'll have to run over all forms in a certain order applying it!... not good enough :(

 

I thing this ins't too confusing and now you can find my question a little more logical... Still brings a lot of forms overlaping, I know, but in certain types of applications this is required... And again I question myself why is it in VB6 and not it .net???

 

:(

 

Thanks guys

Software bugs are impossible to detect by anybody except the end user.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...