There are many cases in which you need to visually
associate shapes that are logically related. It is easy to draw a box
around items and then label them with a text block, but Visio offers a
better way.
Visio 2010’s new Container
and List shapes make organizing sets of shapes a snap. Shapes can be
easily added and removed from them, and all member shapes conveniently
move along with their parent containers.
Let’s look at how containers and lists can add structure and organization to your diagrams.
Containers
Containers are special
shapes designed to visually group other shapes together and to make it
easy for you to maintain these relationships. Container shapes consist
of a rectangular region where member shapes are contained, plus a title
area called a header.
Organizing Shapes with Containers
Although containers are
shapes, they’re so cool and important that you don’t access them from a
stencil. Instead, they are built right into the user interface on the
Insert tab. Let’s look at adding shapes to and removing them from
containers.
1. | Start a new drawing from any template, such as the Basic Network Diagram.
|
2. | On the Insert tab, expand the Container gallery in the Diagram Parts group.
|
3. | Select a container item from the gallery. You should see a new container shape in the middle of your page.
|
4. | Drag
shapes from any stencil and drop them on top of the container. Notice
the orange highlighting as you drag a shape over the container. This
highlighting tells you that the shape will be added to the container.
|
5. | Click
on a shape in the container. Notice that it is easily accessible and
not “buried” inside the container as grouping does . Also notice that the container is highlighted with a
thin, orange outline. This tells you which container contains the
selected shape.
|
6. | Select
the container shape. Note that if you click in the middle of the
container, you are not able to select it. This is so that you can select
member shapes without accidentally moving the container itself. To
select the container, you need to click on the very edge or on the
header. You see the mouse cursor changes to crosshairs when you are over
a selectable part of the container.
|
7. | Move the container by dragging it around the page. See how all the member shapes follow the container?
|
8. | Make
the container bigger or smaller by pulling on any of the eight blue
resizing handles. Notice that you can’t make the container smaller than
its member shapes.
|
9. | Drag
a shape out of the container so that it is in a blank area of the page.
This shape no longer moves with the container. Removing a shape from a
container is that easy.
|
10. | Duplicate
the container several times. You can do this quickly by Ctrl+dragging.
Or try selecting a container and then pressing Ctrl+D to duplicate it.
No matter how you copy a container, all the member shapes are duplicated
along with it; you don’t need to select the member shapes at all.
|
11. | Now
delete one of the duplicate containers. All the member shapes are
deleted along with the container. This is very convenient but might be
unexpected the first few times you do it.
|
12. | Right-click
a container and notice the Container menu item. This contains many
container-specific actions, which are also available on the contextual
Container Tools tab in the Ribbon.
|
13. | Expand
the Container menu to see its subitems; then choose Disband Container.
The container is deleted, but this time, the member shapes are not deleted. This is handy if you want to get rid of the container, but keep the members.
|
14. | Select the shapes that remain from the container that you disbanded in the previous step.
|
15. | On
the Insert tab, select a new container from the Container gallery. A
new container is placed behind the select shapes, effectively “slipping a
new container under” the selected shapes.
|
Changing an Existing Container
In Figure 3.1,
you might have noticed the Container Tools contextual Ribbon tab. This
tab is available when you have one or more container shapes selected or
when shapes that belong to containers are selected. You might also have
noticed the Containers context menu that appears when you right-click a
container.
Let’s explore some things you can do to existing container shapes.
1. | Start with any drawing that has a container that contains a few shapes.
|
2. | Select the container; then click the Format tab under the Container Tools contextual tab.
|
3. | In
the Container Styles gallery, click a new style. As you move your mouse
cursor over the various styles in the gallery, notice how Live Preview
shows the way your container will look, as depicted in Figure 2. Click a new style to change the look of your container in-place.
|
4. | Similarly,
you can change the look of the container’s heading by browsing the
Heading Style gallery to the right of the Container Styles gallery.
|
5. | Resize your container so that there is lots of extra space, beyond what the member shapes require.
|
6. | Click
the Fit to Contents button in the Size group on the Container Tools
tab. The extra space in the container disappears, and the container
neatly and tightly encloses its members.
|
7. | Click
the Margins drop-down to the left of Fit to Size. Mouse over the
various items in the list. Notice how the padding, or margins, of the
container increase and decrease. If you drag member shapes near the
edges of the container, orange lines will appear to help you align
shapes to the margins of the container.
|
8. | With
the container selected, click the Lock Container button in the
Membership group. Now try to remove member shapes from the container by
dragging or deleting them. You can’t do it. If you try to move a shape
off the container, the container just gets bigger and keeps the shape
within its boundaries. You can click the Lock Container button again to
unlock the container.
|
9. | From the Automatic Resize drop-down, choose Always Fit to Contents.
|
10. | Move
the container’s member shapes around. Notice how the container expands
and contracts to accommodate the shapes. If you unlock the container,
this behavior will change slightly because you will be able to remove
member shapes from the container.
With Always Fit to Contents, expanding the container is a bit tricky. If
you move a member shape too far, then it will jump out of the
container. If you move it partially off the edge of the container, then
the container will expand. A neat trick is to select a member shape and
then move it by pressing the arrow keys. The container will keep
expanding as you move the shape towards the edge, but the shape won’t
jump out of the container.
|
The
Container context menu actually exists for all shapes. For shapes that
aren’t containers, however, there are only two items instead of six.
They are Add to New Container and Add to Underlying Container.
The first item provides a quick
way to wrap selected shapes in a container without going to the Ribbon.
A default container appears around the selected shapes, and you can
change its look later using the Container Tools tab. If you are creating
a lot of containers, this approach can save you a bunch of time.
The second item helps in
the event that a container gets slipped under a shape. This happens when
a container is stretched so that it encompasses nonmember shapes or if a
container is moved underneath nonmember shapes. In these cases, shapes
are not automatically added to the container. Clicking Add to Underlying
Container adds the shapes to the container.
Another way to accomplish the
same effect as using Add to Underlying Container is to just nudge the
shapes. Either grab them with the mouse and move them slightly, or nudge
them with the arrow keys. For example, pressing the left-arrow key and
then the right-arrow key adds the shapes to the container but returns
them in their original positions.
|
Containers are powerful, useful,
easy to use, and fun! It is important to note that they are not just
boxes with text: they are structured drawing elements understood by
Visio as more than just graphics. This has implications when it comes to
validating diagrams against corporate standards and when programming
custom solutions on top of Visio.