Moosli
Moosli

Reputation: 3230

In C# change visio Shape Position

Hi im working with c# where i insert a axDrawingControl for Visio...

So now my question, if i insert a visio shape

currentPage.Drop(positionStencil.Masters["Pos1"], 0.8, 4.2);

How can i change the Position of the shape now?

Thx for you help

Upvotes: 1

Views: 2196

Answers (1)

saveenr
saveenr

Reputation: 8619

Set the PinX and PinY cells. Typically you'll set these to the center of the new location you want to shape to appear.

var shape = currentPage.Drop(...);
shape.CellsU["PinX"].Formula = "2";
shape.CellsU["PinY"].Formula = "2";

(The sample above is for C# in Visual Studio 2010, the code will look a little less clean in Visual Studio 2008)

Just to be complete: You should read up on the LocPinX and LocPinY cells because these affect how PinX and PinY are interpreted. It shouldn't have any impact on your scenario thought.

If you have to do this for a number of shapes instead of just one, it is more efficient to use the SetFormulas method (available on the Page and Shape object depending on your needs).

Upvotes: 2

Related Questions