flipping a container

Started by perry59, December 11, 2020, 10:10:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

perry59

I'm working on an addin that create shapes to represent electrical connectors. The connectors themselves are containers (I simply added the user row "msvStructureType" with a value of "container" to an existing shape). I am pleased with how this works but sometimes these connectors need to be mirrors on the vertical axis depending on which directions wires are coming into it.
Before going the container route, when they were simple group shapes, it was simple to flip them with code like...
Shape.FlipHorizontal()
all the relationships between the connector shape and its contents, including text justification remained intact.
now, with containers, that code seems to have either no effect or a bad effect. The only way I have been able to get the desired results is to remove the container property from the shape, flip it, then make it a container again. This seems like a bit of a kludge. Anyone have any suggestions?
Thanks
what, me worry?

wapperdude

Why change to container?  Some constructs are more appropriately grouped shapes. 
Visio 2019 Pro

perry59

true, but containers do have some nice features, for example it's quick and easy to iterate their contents with shape.ContainerProperties.GetMemberShapes(Visio.VisContainerFlags.visContainerFlagsDefault).
It's also easier to move/edit subshapes in a container, doing that with grouped shapes is not quite as nice.

at any rate, if it is not possible to flip a container and it's contents I'll just go back to grouped shapes (a lot more coding work) or just make new container shapes representing "flipped" versions.
what, me worry?

wapperdude

Well, you can get most of the way there... sort of.  Select the container and all its shapes and group them.   Do your flip.  Ungroup. 

If you take a look at shape sheet (set it to show formula) of a shape within a container, you'll see that PinX and PinY do not directly reference the container, as would be the case in a grouped shape.  So, flipping the container has no impact. 
Visio 2019 Pro