Stop shapes being plowed off page

J

John

Hi there,

I'm trying to programmatically drop a number of shapes in random positions
across a page. I'm allowing shapes to plow and be plowed, but this results
in them being pushed off the page.

Does anyone know a method that will allow plowing but retain all of the
shapes within the page?

I've had a quick look at the automated "Layout Shapes", but I want to ensure
that the shapes retain their random order and layout (ie not lined up
grid-style).

(NB - None of the shapes are connected)

Best regards

John
(VS2003)
 
J

JuneTheSecond

You would check the values of PinX, PinY, Width, Height cells of shapes, and
you would compare them against the values of PageEidth and PageHeight cells
of the page.
 
J

John

Hello June,

Thanks for that. Yes, I'd considered that and I guess this would be an ok
solution if there are only a few shapes on the page, but what happens when
the page becomes full of shapes? A perfect solution (for this instance)
would then allow some overlap as being on the page is more important than
perfect separation...................or thinking about it, maybe the
dropping shapes could be prevented if there is no more space on the page?

Any other thoughts?

Best regards

John
 
M

Markus Breugst

Hi John,

I think the BOUND function is exactly what you need. (I think it's only
availible in Visio 2003 (and 2007Beta of course)).
Just insert the following formulas into the PinX and PinY cells of your
shapes and they will never leave your page again.

PinX = BOUND(50 mm,0,FALSE,Width/2,ThePage!PageWidth-Width/2)
PinY = BOUND(50 mm,0,FALSE,Height/2,ThePage!PageHeight-Height/2)

You can find information about this ShapeSheet function in the Visio
developer help.

Best regards,
Markus

John said:
Hello June,

Thanks for that. Yes, I'd considered that and I guess this would be an ok
solution if there are only a few shapes on the page, but what happens when
the page becomes full of shapes? A perfect solution (for this instance)
would then allow some overlap as being on the page is more important than
perfect separation...................or thinking about it, maybe the
dropping shapes could be prevented if there is no more space on the page?

Any other thoughts?

Best regards

John
 
J

John

Hello Markus,

That's perfect. Thanks very much for your help.

Best regards

John


Markus Breugst said:
Hi John,

I think the BOUND function is exactly what you need. (I think it's only
availible in Visio 2003 (and 2007Beta of course)).
Just insert the following formulas into the PinX and PinY cells of your
shapes and they will never leave your page again.

PinX = BOUND(50 mm,0,FALSE,Width/2,ThePage!PageWidth-Width/2)
PinY = BOUND(50 mm,0,FALSE,Height/2,ThePage!PageHeight-Height/2)

You can find information about this ShapeSheet function in the Visio
developer help.

Best regards,
Markus
 

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