Windows Enhanced Metafile pictures and surrounding Alignment Box

Started by snuuba, February 20, 2020, 05:32:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

snuuba

Hello all,

I've used "Windows Enhanced Metafiles" as background images for my shapes for a while now. While building the background image, the image is ungrouped and there are many separate visio objects, each with their own shapesheet to have more control over the image. As I am about to add the background image to the actual shape, I will copy all the component objects and then paste them back using "Paste - Special - Picture (Enhanced Metafile). As a result you will have a single object with just one shapesheet. This will reduce the size of the object and number of shapesheets associated with the image, making the shape much faster to use and pull from stencil.

There has been a slight hiccup with this solution. When the image is pasted back, the dimensions of the shape increase as an alignment box is added around the image. Furthermore the actual image is off centered relative to the alignment box. As a result you can not use formulas relative to shape dimensions to position the shape, the off centered nature will position the image in slightly wrong position and you will have to position the image manually.

Few days ago I was browsing through the forum and found a topic where someone was using "crop" tool. I had never used it before and decided to give it a try to see if the problem with metafile pictures and alignment box could be solved by using "crop" tool.

As it turns out, it worked. Not a perfect solution, but good enough for me.

Detailed steps can be found from my blog: https://dontpokethepolarbear.wordpress.com/2020/02/20/visio-by-dptpb-reducing-size-of-picture-alignment-box


I tried to copy the blog post here, but it didn't work out, probably because of the images used. I hope you don't mind links pointing outside of the forum...





Croc

Cropping is a tedious process. Many people use a different technology - they group the external frame (Visio shape) and the internal content (Metafile). This technology provides metafile benefits and dimensional accuracy.

snuuba

Hi,

Your way is roughly the way I am actually using metafile. In case of a rack mounted equipment, create a line that is 19" long, group it, change the group to 1-dimensional shape and add the metafile in that group.

For the metafile I would like to use following shapesheet settings to position it:
PinX: sheet.xxx!width*0.5 (parent shape width*0.5)
PinY: Height (of the metafile)
LocPinX: Width*0.5
LocPinY: Height

However if I do that with uncropped metafile, the image is positioned incorrectly due to the offset with the alignment box. The image actually lands slightly too high and too much right and I have to adjust shapesheet values a bit or manually drag the image in the correct position.

With cropped metafile, the image is positioned right in the middle horizontally and at the correct height

In the attachment I've left the "line" shape used to make the group in place to make the difference more obvious, normally I would remove it. The upper shape is with uncropped image and it sits little bit too high and too much right. While the second shape is with cropped metafile and it is positioned correctly. Both are using the same shapesheet positioning settings.





snuuba

Maybe attached example shows better what is happening with pasted metafiles.

- The same 19" line grouped and then turned into 1-dimensional shape
- Two rectangles added to the group
- Green rectangle is just a basic visio rectangle shape, 19" wide, 3.5" high
- Red is the same shape, just color changed to red, then copied and pasted back as metadata image, the size is now 19.3323" x 3,8866"
- Both are using the same shapesheet settings for positioning
- Yet metadata shape sits too high and too much right, due to extra slack around the rectangle shape and off centered positioning of the actual rectangle shape with in its own alignment box

snuuba

Changed line patterns slightly, so you can see overlapping shapes.

By cropping the metadata image, you can actually make it to land nearly ideal position and overlap green rectangle, while using the same shapesheet positioning settings. There are still some differences as I didn't spend too much time with cropping.