get and set x y co-ordinate of shape

Started by sirfamol85, December 02, 2010, 04:39:25 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sirfamol85

Hi All,
I am trying to use a traditional way of hiding the shape using
NoFill
NoLine
NoShow
Miscellaneous.HideText properties.

What is my senario is I have parent shape , on some event of parent shape I am hiding all of the childs.
I can change the above 4 properties and make the child shapes invisible partially. To hide them fully I need to move all the child shapes under the parent shape.
For the same i need to get the parent shape's x and y co-ordinate and move all the childs on same co-ordinate.
My roadblock is how to get the shapes x and y co-ordinate and set same for other shapes? I have tried many possibilities like

to get parent shape x and y -
  parentX= oShape.Cells["PinX"].get_Result("mm");
  parentY = oShape.Cells["PinY"].get_Result("mm");

to set child shapes x & y -
ActiveWindow.DeselectAll();
ActiveWindow.Select(childShape, (short)VisSelectArgs.visSelect);
ActiveWindow.Selection.Move(parentX, parentY, "mm");

but the child shapes are not going under parent shape :(
Please suggest.

Jumpy

Quote
parentX= oShape.Cells["PinX"].get_Result("mm")

What is get_Result??? I only know to work (in VBA):
parentX= oShape.Cells("PinX").Result("mm")

Later in the code than for each childshape you set the PinX and PinY cell instead of using Move:
childShape.Cells("PinX").Result("mm") = parentX
childShape.Cells("PinY").Result("mm") = parentY

---------------

But I would first of all think, if it really has to be done in Code. It would be much more easy and smooth to accomplish that in the ShapeSheet.
Give all shapes a user defined cell User.Visible that is either true or false. If False, make the shapes invisible with a formula in NoShow and so on, that references the User.Visible cell. For example in NoFill = Not(User.Visible).
Then Formulas in PinX/Y like =If(User.Visible,40 mm,Sheet.12!PinX)  when Sheet.12 is the parent shape.

sirfamol85

Hi Jumpy,
thanks for pointing the appropriate way.
I will try to implement that.

aledlund