BLOGS BY TOPIC
BLOGS BY AUTHOR
BLOGS BY YEAR
Microsoft Visio lets you create far more than simple static diagrams. In this blog series we show you how to use Shape Data and the ShapeSheet to create a dynamic shape that will change its dimensions when you choose a value from a drop down list.
Posted by Andrew Gould on 21 June 2012
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Controlling Shape Size in Visio Using Drop Down Lists
On a recent Microsoft Visio training course I offered to demonstrate how to add a drop down list to a shape's custom properties and use this to control the height of the shape. Unfortunately, I failed miserably. I've since discovered the reason for my abject failure and thought it was worth writing a short blog to explain the solution to the people on the course and anybody else who might be interested. Thanks guys, you can stop laughing now!
For this blog I'm using Visio 2007, but you can achieve the same results in earlier and later versions of Visio.
What I was Attempting to Achieve
The shape that I was attempting to create on the training course was intended to represent a rack of shelving in a warehouse. The dimensions of a single rack had to be one of a set list of sizes (small, medium and large for the sake of a simple demonstration) and so a drop down list that controlled the shape size seemed like an elegant solution.
Choosing a different size from the drop down list should affect the dimensions of the shape.
To achieve the effect shown above requires a bit of effort, but should save us time in the long run.
Creating the Basic Rectangle Shape
The starting point for this particular shape is a simple rectangle. There are several stencils in Visio that contain a shape suitable for our purposes but I'm going to use the basic Drawing Tools toolbar to create ours.
To display the Drawing Tools toolbar, click this button.
You can now use one of the buttons on the toolbar to draw a simple rectangle shape on the page. To do this:
- Click the Rectangle tool.
Click this tool to begin drawing a rectangle.
- Click and drag on the page to draw a rectangle.
|Click and drag to draw a rectangle.||Release the mouse to finish drawing.|
- To avoid accidentally drawing lots of rectangles all over the page remember to click back on the Pointer Tool.
Click on this button to make the mouse cursor behave normally again.
Setting the Dimensions of the Shape Manually
Although eventually we'll control the size of the shape using a drop down list, it's worth changing the size of the shape at this point so that it matches one of the rack sizes we'll be creating later. We can do this roughly by clicking and dragging on the resizing handles (the six green squares around the border of the shape), but it's much more accurate to use the Size & Position window. To display this window, from the menu choose: View > Size & Position Window.
By default the Size & Position window appears docked in the lower left hand corner of the screen. The window displays the dimensions and position of any shape that you select on the page.
When you've selected a shape you can type the dimensions you want into the Width and Height properties in the Size & Position window.
Type a number followed by the units you want to use, such as mm, cm, m, etc.
You can also use imperial measurement units, or US units as Visio calls them, in your diagrams. You might be interested in this page which describes all of the measurement units available in Visio.
Now that we've set up the basic shape we're going to use to represent our shelving rack the next step is to create a way for users to select the size they want. To do this we're going to create a new property using Shape Data. Read the next part of this series to find out how.