Author Topic: flipping a container  (Read 293 times)

0 Members and 1 Guest are viewing this topic.

perry59

  • Full Member
  • ***
  • Posts: 226
flipping a container
« on: December 11, 2020, 05:10:14 PM »
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

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3936
  • Ideas Visio-lized into solutions
Re: flipping a container
« Reply #1 on: December 11, 2020, 11:57:22 PM »
Why change to container?  Some constructs are more appropriately grouped shapes. 
Visio 2019 Pro

perry59

  • Full Member
  • ***
  • Posts: 226
Re: flipping a container
« Reply #2 on: December 14, 2020, 06:30:27 PM »
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.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3936
  • Ideas Visio-lized into solutions
Re: flipping a container
« Reply #3 on: December 14, 2020, 07:51:22 PM »
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