Shapes Location

Z

ZyRaIN

Hi again guys:)

Got another problem, I've exported the images without any trimming and
so on.

But now when I get the shapes location it dose not match the actual
place on the image.

Example I get that shape1 should be located at x,y but if I manually
draw a box at this point it dose not match anything. I'm well aware
that visio's coordinates starts at the buttom left and in visual studio
it starts up left corner. But this is not my problem here even if I
substract the height from the whole page from the y coordinate of my
shape I don't get it right?

Am I doing this all wrong ?

Sincerely
ZyRaIN
 
P

Paul Herber

Hi again guys:)

Got another problem, I've exported the images without any trimming and
so on.

But now when I get the shapes location it dose not match the actual
place on the image.

Example I get that shape1 should be located at x,y but if I manually
draw a box at this point it dose not match anything. I'm well aware
that visio's coordinates starts at the buttom left and in visual studio
it starts up left corner. But this is not my problem here even if I
substract the height from the whole page from the y coordinate of my
shape I don't get it right?

Visio defaults to inches for measurements. Divide your coordinates by
25.4
Also, ensure that you take into account the shape's LocPinX and
LocPinY
 
C

Chris [Visio MVP]

Check the developer help for

ResultIU
FormulaU
Result( )

The last one allows you to get info from ShapeSheet cells (which are how
shapes are defined) in various formats.

So you could query a shape like this:

x = shp.Cells("PinX").Result("mm"")

and get a nice metric number. "IU" denotes internal units, so ResultIU gives
you inches, always.
 
Z

ZyRaIN

It realy helps - But I need to figure out how I get the pinx at the
button corner of the shape, when I look at the formula in visio is says


Pinx = alligncenter - 0,5*width +locPinx

Which is at the center of the shape.
 
C

Chris [Visio MVP]

Now you're an expert!!

The AlignCenter stuff just means it's glued to a guide. With Results, you
get a number, not the formula, which you've probably figured out.

Also, check out the BoundingBox method for getting shape extents without
having to subtract LocPinX from PinX and account for rotation, etc.

- Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top