BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

SendBackword method

Started by JuneTheSecond, November 07, 2009, 08:33:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.



This theme is the interesting question about z-order of the shapes in Microsoft Visio Discussion forum for developer.

When I tested the Shape.SendBackword method, I found this method does not work many times.
If 2 shapes are overlapped each other, you can run this method as many as the z-order of 2 shapes are reversed.
But if 2 shapes are not over lapped, this method does not work correctly.

Attached is a sample drawing with such VBA macro.
Best Regards,

Junichi Yoda



I've made a macro that sawps z-order of 2 shapes that overlap each other.
When you select 2 shapes that are overlap, the macro starts and swap z-order. :)  :)  :)
Best Regards,

Junichi Yoda



The macro in the above is designed to send backward the shape at the forward.
If the z-orders are continuous between 2 shapes, z-order of 2 shapes are exchanged in each other.
There is no problem.

Z-order of 2 shapes are not always continuous, if there are many shapes on the page.
Sometimes you need to bring forward the shape at backward.

Then I modified the macro so that you can select the direction to send shape.

At the left in the figure "Image43.jpg", the index (z-order) of orange shape is 1, and blue shape is 12.
When you select 2 shapes, the dialog appeared has 3 control buttons, "Yes, "No" and "Cancel".
If you press "Yes", the blue shape is sent backward repeatedly until it comes at the back of the orange shape.
Then the index (z-order) of the blue shape becomes 1, and orange becomes 2.

On the other hand, if you press "No", the orange shape is brought forward repeatedly until it comes at the front of the blue shape.
Then the index (z-order) of the orange shape becomes 12, and blue becomes 11.

After these operations, the z-orders of 2 shapes are now continuous.
You can easily exchange z-orders in these 2 shapes with the dialog that is shown at the right figures.
Best Regards,

Junichi Yoda

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 170 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1048KB.
Tokens: post-login.
Cache hits: 13: 0.00138s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]