How to change a control's Z-Property?
Hi,
How do I change an Imagebox's Z-Property?
Currently, on the vb.net form, there are a few Imagebox controls. By default, the Imageboxe added later will block the rest of the imageboxes when they are placed on top of each other.
e.g Imagebox3 will block Imagebox1 when they are placed on the same position in the form.
Currently there are 4 imageboxes on the form. How do I make Imagebox3 block the rest of the imageboxes and for imagebox4 to block out imageboxes 1 and 2?
Is it possible to change each control's z-property individually?
Re: How to change a control's Z-Property?
Z-Index?
I think there's a ZOrder method, or I might be spouting bilge.
Re: How to change a control's Z-Property?
It isn't possible to set a contol's position in the z-order explicitly. All you do is call BringToFront or SendToBack on each control in the appropriate order and they will be stacked accordingly. You can do this at run time or you can do it at design time by right-clicking on the control in the design window.
Re: How to change a control's Z-Property?
So I'll use something like this:
Imagebox3.BringToFront() 'Covers all the imageboxes
Imagebox4.BringToFront() 'Covers all the imageboxes except for Imagebox3
Is it correct?
Re: How to change a control's Z-Property?
Wrong. If you call BringToFront on Imagebox3 then it will be brought to the front, so in front of every other control. If you then call BringToFront on Imagebox4 then it will be brought to the front of evey other control including Imagebox3. If you call BringToFront on every control the the first one you call it on will be at the back and the last one will be at the front. The opposite is true of SendToBack. Just imagine that the controls are a pack of cards. If you bring each of the 52 cards to the front, one after the other, then the first one would be end up the back.