Anchoring scaled shapes to page corners in #Visio

I have read that other users have bemoaned the lack of a anchor to top left, or something similar in Visio, so I thought I would demonstrate the issue, then propose a solution. In particular, there are some master shapes on the Annotations and Title Blocks stencils in the Visio Extras category that you would expect to have this capability, but don’t. Wouldn’t it be useful to have the ability to keep the shape size and anchor position to page bottom left, bottom right, top right or top left? This would mean that the page size or scale could be changed, but the annotations and title blocks could remain anchored.

This slideshow requires JavaScript.

First, it is important to know that Visio shapes are anchored, by default, to the bottom left of a page (or the shape that they are inside the group of). These values are returned from the formulas in the PinX and PinY cells.

Secondly, the location of the pin within the shape is defined by the formulas in the LocPinX and LocPinY cells, and these are relative to the bottom left corner of the shape.

Then it is just a matter of adding some Actions rows to the ShapeSheet of each master in the Document Stencil. The principle is to utilise the User.AntiScale value to reset the formulas in the WidthHeight, PinX or PinY cells. The User.AntiScale row exists in many Master shapes because it is useful for de-scaling values. It has the formula:

=ThePage!DrawingScale/ThePage!PageScale

 

Anchor10

The actions for the important rows are:

sppSaveSize

=SETF(GetRef(Width),"="&((Width/User.AntiScale))&"*User.AntiScale")+SETF(GetRef(Height),"="&((Height/User.AntiScale))&"*User.AntiScale")

spp01

=SETF(GetRef(PinX),"=User.AntiScale*"&(PinX/User.AntiScale))+SETF(GetRef(PinY),"=User.AntiScale*"&(PinY/User.AntiScale))

spp02

=SETF(GetRef(PinX),"=ThePage!PageWidth-User.AntiScale*"&((ThePage!PageWidth-PinX)/User.AntiScale))+SETF(GetRef(PinY),"=User.AntiScale*"&(PinY/User.AntiScale))

spp03

=SETF(GetRef(PinX),"=ThePage!PageWidth-User.AntiScale*"&((ThePage!PageWidth-PinX)/User.AntiScale))+SETF(GetRef(PinY),"=ThePage!PageHeight-User.AntiScale*"&((ThePage!PageHeight-PinY)/User.AntiScale))

spp04

=SETF(GetRef(PinX),"=User.AntiScale*"&(PinX/User.AntiScale))+SETF(GetRef(PinY),"=ThePage!PageHeight-User.AntiScale*"&((ThePage!PageHeight-PinY)/User.AntiScale))

 
Once the master shape in the Document Stencil has been edited, it is important to tick the Match master name on drop option in the Master Properties. This ensures that the enhanced master is used, even if the original Master shape is dragged and dropped from the Annotations or Title Blocks stencils.
Of course, I add these rows with a little bit of code …

One Response to “Anchoring scaled shapes to page corners in #Visio”

  1. Surrogate™ Says:

    David, thank you !

    Great article !


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Chris Webb's BI Blog

Microsoft Analysis Services, MDX, DAX, Power Pivot, Power Query and Power BI

davecra.wordpress.com/

Microsoft Office 365 Development, and more...

PowerShell.Amsterdam

Automate, Accelerate, Accurate

johnvisiomvp

Life with Visio and other Microsoft Toys!

Title (Required)

Windows Server Essentials Tips & Tricks

Nilsandrey's Weblog

Just another WordPress.com weblog

Things that Should be Easy

Every so often (too often in the IT industry) I encounter things that should have been very easy to do but turned out to be far too complicated. My favorite topics include SharePoint, .Net development, and software architecture, especially distributed systems.

Visio Guy

Shapes, Stencils, Drawings Templates, Tutorials, Tips & Developer Info for Microsoft Visio

Hannes's Virtual Earth

Tips & Tricks around Mapping and Cloud Computing

Pluralsight blog

be smart, be clear, be visual ...

%d bloggers like this: