September, 2009

Visio Insights
The official blog of the Microsoft Visio product team

September, 2009

  • Visio Insights

    Applying a Background or Border Design in Visio 2010


    Visio 2010 introduces a new way to apply a background or border and title design to your diagrams. The new Backgrounds and Borders & Titles galleries on the Design tab in the ribbon let you choose from a variety of styles and apply them with one click.



    For several versions, Visio has provided a way to apply a background design to diagrams using shapes that you drag out from the Backgrounds stencil that opens with many of the templates. In Visio 2010, you can do this by clicking on a preview thumbnail in the Backgrounds gallery.


    When you apply a background, Visio creates a background page (named “VBackground-1”, if it’s the first one), drops the background shape on it, and assigns it to the foreground page.


    If you right-click on the preview thumbnail in the Backgrounds gallery, you can choose to apply it to all the pages in the document or just the current page.

    Apply al all or current page

    Once the background page is created, you can click on its page tab to put additional items on it that you want to appear on all the foreground pages it’s assigned to, like your company name or logo.

    The color of the background can be defined by a theme. After a background is applied, additional themes with background colors appear in the Themes gallery. When one of these themes is applied, the background takes the color from the theme.

    Themes with dark backgrounds

    You can also click on the Background Color command at the bottom of the Backgrounds gallery to pick a color.

    Background Color Picker

    Borders & Titles

    You can apply border and title designs to your pages in a way similar to backgrounds, using the Borders & Titles gallery on the Design tab. As with the Backgrounds gallery, a background page is created to hold the border shape. And you can right-click on the gallery thumbnail to choose to apply the border to all the pages in the document or just the current page.


    You can edit the border’s title by clicking on the background page tab, selecting the border shape, and typing a title. This title will appear on all the foreground pages that the background page is assigned to, so it works best as a document title rather than a title for individual pages.

    Title Editing

    If you don’t want the border’s footer (which usually includes a page number) to appear at the bottom of the page, you can right-click on the border shape on the background page and choose Hide Footer.

    Hide Footer 

    Let us know what you think about the new Backgrounds and Borders & Titles features in the Visio 2010 Technical Preview using Send a Smile or a comment on the blog.

  • Visio Insights

    AutoConnect in Visio 2010


    AutoConnect was a feature first introduced in Visio 2007. The original intent of the feature was to simplify the creation of connected diagrams such as business process flowcharts by accomplishing multiple tasks in a single action:

    1. Dropping a new shape on the page.

    2. Connecting the new shape to the original shape.

    3. Aligning and spacing the new shape attractively with other shapes in the diagram.

    The notable efficiency is that AutoConnect accomplishes these tasks without the need to switch to the Connector tool (and subsequently back to the Pointer tool).

    In Visio 2010 we have extended AutoConnect to make the creation of connected diagrams even more efficient. Here’s a summary of the new features.

    Adding a new connected shape from a stencil’s Quick Shapes

    In many ways, AutoConnect’s core ability of adding new connected shapes works much the same as it did in Visio 2007 – with one very significant enhancement in Visio 2010. AutoConnect now allows you to choose from up to four Quick Shapes from the current stencil as the added shape.

    Note: Quick Shapes represent a subset of shapes that are more commonly used within a given stencil. For more information on the new Quick Shapes feature in Visio 2010, see the earlier blog post concerning the new enhancements to the Shapes Window.


    In the image above, when hovering over the AutoConnect arrow to the right of shape #1, a Mini Toolbar appears that contains the first four shapes from the Quick Shapes area of the active stencil in the Shapes window. As you point to a shape on the Mini Toolbar, a live preview of the shape and the connector is shown on the page. Clicking on the shape adds it to the page, connected, aligned, and spaced.

    Connecting to another shape in the diagram

    As you create and edit connected diagrams, very often the need is to connect one shape to another already on the drawing page. AutoConnect can simplify this task in a couple ways.


    In the image above, AutoConnect automatically previews a connector between the original shape (#1) and a neighboring shape (#2) when hovering over the AutoConnect arrow. Clicking on the arrow completes the connection. The neighbor connect feature looks for a shape in close proximity in the direction of the respective AutoConnect arrow. (Note: The neighbor connect feature was not functional in the Tech Preview of Visio 2010 but will be fixed in the Visio 2010 Beta.)

    But what if the intent is to connect shape #1 to shape #3? In Visio 2010 this can now be accomplished by simply dragging a new connector from any AutoConnect arrow.



    In the sequence above, after hovering over the AutoConnect arrow to the right of shape #1, a connector is dragged to the target shape #3. The connector can be glued dynamically to shape #3 as shown or to a particular connection point if desired. Although the behavior while dragging is identical to that of the Connector tool, the important distinction is that switching to the Connector tool was not required and further diagram editing can continue with the Pointer tool.

    As always, we're interested in your feedback on the enhancements we’ve made to AutoConnect, so use the Send a Smile feedback tool or comment on the blog to let us know what you think.

  • Visio Insights

    Cross-functional Flowcharts in Visio 2010


    For flowcharts that have clearly defined stakeholders and assignments, cross-functional flowcharts are often used. Today, cross-functional flowcharts can span a whole conference room’s wall. The number of swimlanes can grow to five or even ten! At the beginning of the Visio 2010 planning, we heard from our users that it is hard for them to manage swimlanes and to author large cross-functional flowcharts. We decided that we need to make our cross-functional flowchart more scalable and easier for repeated editing and collaboration.

    Here is a list of the top cross-functional flowchart improvements we have made in Visio 2010:

    1. Simpler Creation Experience

    Just like in the past, you can create a cross-functional flowchart starting from the Cross-functional Flowchart Template. Upon creation, we will automatically create two swimlanes in the cross-functional flowchart for you. To add more swimlanes, you can now mouse along the edge of the cross-functional flowchart to where you want to add the swimlane, and a blue arrow will appear.


    Click on the blue arrow and voila, you have a new swimlane inserted!

    2. Cross-functional Flowchart Configurations (i.e. “You’ve got options!”)

    Once you have created your cross-functional flowchart, you have several options to modify the cross-functional flowchart to your liking. While in the past you had to decide on the flowchart orientation at creation time, you can now change that any time you want, even long after the flowchart is created.

    For example, here’s a horizontal cross-functional flowchart:


    To change to vertical orientation, you can simply visit the new cross-functional flowchart tab and use the Orientation drop-down menu to switch to a vertical cross-functional flowchart!


    Similarly, if you look at the cross-functional flowchart tab, you also have other options such as the showing/hiding of the title or phase bars and the direction of the cross-functional flowchart.

    3. Swimlanes as Containers

    We’ve discussed the idea of containers in one of our previous posts. One fun fact about the new cross-functional flowchart in Visio 2010 is that swimlanes are containers! Effectively, a cross-functional flowchart in Visio 2010 is in fact a list of containers. What does that mean to you? First, a swimlane highlights when shapes are added to a swimlane:


    Second, you can easily reorder swimlanes and the shapes they contain will come along!

    4. Editing with Fewer Fix-ups

    One common feedback we get from users is that once they have created the flowchart, there is still a lot of fix-up needed. For example, users would often need to align the shapes and fix-up connectors. Cross-functional flowchart is no exception. In one of our previous posts, we discussed how flowchart routing hass been improved. This applies to cross-functional flowcharts as well: cross-functional flowcharts use the same routing style and direction as simple flowcharts, but the additional presence of swimlanes and phases can lead to routes that get hidden because they overlap with swimlane and phase boundaries.

    In Visio 2010, the routing engine looks for these overlaps and adjusts routes to avoid them. If necessary, Visio also moves the glue points of dynamic connectors to different sides of shapes to avoid the boundary.


    In future posts, we will introduce more improvements for flowcharting, many of which will also benefit cross-functional flowcharts. So stay tuned!

    Please use the Send a Smile feedback tool or comment on this post if you have further thoughts on the cross-functional flowchart feature in Visio 2010. We would love to hear from you!

  • Visio Insights

    Inserting and Deleting Shapes in Visio 2010


    Diagram maintenance is a task that everyone performs, and many users spend much of their time in Visio maintaining existing diagrams.  We realize that a fair amount of the time you spend maintaining your diagrams is spent in the mechanics of the task, rather than achieving the goals of updating the concept the diagram represents.  There are some clear gains we can effect to make your life easier as you go about editing your diagrams.

    Consider a typical flowchart.  You documented an internal process and now need to add some steps to the process diagram.  Prior to Visio 2010, this meant facing what could be a tedious task of ungluing connectors, selecting and dragging shapes to make room for the new ones, adding the new ones, positioning them neatly, re-gluing connectors, adding new connectors and moving the other shapes into position to leave you with a nice, neat diagram.

    In Visio 2010, as part of our focus on ease of use and improving core process diagramming, we have simplified this basic, repeated task dramatically.  Now, all you need to do is drag your new shape out and drop it on the connector you wish to split.  Visio highlights the endpoints of the connector to make it clear which connector will split.  When you drop, Visio moves all the “downstream” shapes over just enough to make room for the new shape.  Visio takes care of positioning the new shape so that it is aligned with and evenly spaced from the shape upstream from it.

    Before: image
    Hover: image
    After: image

    Visio identifies which shapes are “downstream” from the insertion point, moves them in the right direction the right amount and places the new shape in just the right spot.  The lower left rectangle is connected downstream from the inserted shape, but is to its left, so did not need to move.

    At some point you may need to remove a few steps from your diagram.  Prior to Visio 2010, this meant deleting shapes, deleting excess connectors, re-gluing the remaining connectors to the remaining shapes and moving those shapes to align and space evenly with the rest of the diagram.

    In Visio 2010, we take care of the connector healing for you.  When you delete a connected shape, Visio checks how many connectors go into and out of the shape, and which ones have text.  If it is clear how to re-glue the connectors without changing the diagram and which connectors can be removed without losing text, Visio deletes the extraneous connectors and re-glues the remainder.


    We made an explicit decision not to move the remaining shapes to fill in the empty space, as that could easily lead to all those downstream shapes – which could be numerous – overlapping another part of the diagram.  Fortunately, you can simply select which shapes should tighten up and use Auto Align or Auto Space to help you neaten up the diagram.  As you can see above, we also preserve connectors that have text, even when that means not healing.  Text on connectors is important, so better safe than sorry.

    As mentioned, we enabled this behavior for cases where we can make a safe conclusion about how the connectors should heal.  Other than to prevent losing text, when else don’t we try to heal?  If there is more than one connector coming into and going out of the shape being deleted, then it is ambiguous how all the shapes should be re-connected together.  Typical examples of this are shown below.


    Our hope is that these additions, while seemingly small, will have a big impact on reducing your workload as you maintain the millions of Visio diagrams you have all created.  Let us know how this works for you using Send a Smile or through a comment on the blog.

  • Visio Insights

    The Developer tab in Visio 2010


    Visio has long had a setting called “developer mode” that developers and shape designers can enable in order to surface extra functionality. In previous versions of Visio, enabling developer mode made new items appear in couple of different menus (Chris Roth has a good overview here). With Visio 2010, we have taken advantage of our new Fluent user interface by grouping this extra functionality into one Ribbon tab named “Developer”. The result is one central location for working with code and designing shapes in Visio:


    Enabling the Developer Tab

    The developer tab does not appear by default, since we want to provide a streamlined interface for users who do not need it. To surface the Developer tab, click on the Backstage Button, and click on Options. This brings up the Visio Options dialog. Click on the Customize Ribbon section. On the right-hand side, check the box that says “Developer” and press OK.

    Visio Options Beta1

    (Note: an alternate method is to go to the Advanced section in Visio Options and check the box at the bottom that says, “Run in developer mode”.)


    Organization of the Developer tab

    Here is an overview of how the Developer tab is organized, group by group.


    Code & Controls


    These two leftmost groups are common across many Office applications. Use them to work with Visual Basic code and ActiveX controls. Note that the Macros button is also available in the Ribbon’s View tab, so users who do not have developer mode turned on can still access this button.

    Shape Design


    This group contains functions used when designing shapes.

    Clicking on the top part of the Show ShapeSheet button opens the selected shape’s ShapeSheet. (You can read more about the ShapeSheet in a previous post.) Clicking on the bottom part of this button lets you choose to instead view the ShapeSheet for the active page or the active document. This makes these ShapeSheets easier to access than they were in previous versions of Visio.


    The geometry tool is a split button that contains different drawing tools. Note that although a similar button is available on the Home tab, that button only contains the Rectangle, Ellipse, and Line tools, and not the Freeform, Arc, and Pencil tools.


    Clicking on the Shape Name button will open up the dialog that in previous versions of Visio was available under “Format > Special” (this dialog box has been renamed “Shape Name” to better reflect its purpose):

    Shape Name

    The Behavior and Protection dialogs that were previously in the Format menu are in the Shape Design group now:

    Shape Design Group



    This group lets you create a new metric or US stencil.



    This group lets you toggle the view of the document stencil, drawing explorer window, and master explorer window.


    We hope the Developer tab makes your development and shape design tasks more convenient. We’re interested to hear your feedback, so use the Send a Smile feedback tool or comment on this post to let us know what you think.

  • Visio Insights

    Diagram Validation in Visio 2010


    Are all the shapes in my diagram labeled? Do I have any loose connectors that are not attached to other shapes? We have heard from customers that it is often hard to answer these types of questions, especially in large diagrams. As a result, they spend a lot of time manually checking diagrams for errors. At the same time, they have to manually ensure that the different diagrams they create are visually consistent.

    We have also heard from companies that they want to enforce certain diagramming standards or rules within their organization. It’s much easier for different people to understand a diagram if it uses standardized notation. As an example, many companies are adopting BPMN as a standard for business process modeling.

    To help address these needs, we added support for diagram validation in Visio 2010. This allows users to check their diagrams for common errors and allows companies to ensure that employees are following certain diagramming standards. With Visio 2010, we provide diagram validation support for Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow and Business Process Modeling Notation diagrams. Companies can also develop custom rules for their own needs.

    You can access the diagram validation functionality from the Process tab. Once you start working on a diagram with a supported set of rules, you can click the Check Diagram button to see whether the diagram has any issues.


    Visio will either tell you that there are no issues in the document, or it will list the issues in the Issues Window. In the diagram below, a connector is not attached to the next shape in the flowchart. When the Check Diagram button is clicked, Visio displays two issues to fix. To easily find shapes with issues, you can click on an issue and the corresponding shape will be selected.


    Once you fix the listed issues, you can click Check Diagram to check that there are no longer any issues with the diagram.

    Sometimes you might find that an issue does not apply to a certain shape in your diagram. When this happens, you can ignore the issue and Visio will not display it in the Issues Window. If a rule does not apply to the entire diagram, you can also ignore the rule so that no issues associated with that rule are displayed. You do this by right-clicking an issue in the Issues Window, and selecting the appropriate option.


    Using the same menu, you can also choose to display the ignored issues and to rearrange issues in the Issues Window so that issues with the same rule, category or page are next to each other.

    Validation rules are grouped into logical sets of rules, such as BPMN and flowchart rule sets. When you create a new Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow or Business Process Modeling Notation diagram in Visio 2010, the appropriate rule set is automatically available in your document. It is also easy to import the flowchart rule set into flowchart diagrams made with previous versions of Visio. Simply open your legacy diagram in Visio 2010 and, on the Process tab, click the Check Diagram pull-down menu and then click Import Rules From.


    The flowchart rule set is always available to import into a diagram. You can also import rules from other Visio diagrams. Any open diagrams with rules sets will be listed as possible sources to import rules from. This makes it easy to add new validation rule sets to any diagram.

    In our next post, we’ll talk more about how validation rules are stored in a diagram, and how a developer can write new validation rules.

    We are interested in your feedback on diagram validation, so use the Send a Smile feedback tool or comment on the blog to let us know what you think.

  • Visio Insights

    Introducing Mr. Clarity


    Harry Miller and Jonathan Foster in Office Content Publishing recently created a new educational video series called “Clarity," whose aim is to encourage people to learn more about how to use Visio. (Note that these videos feature Visio 2007, rather than the newer Visio 2010 Community Tech Preview we have been discussing on the blog recently.) Here are the first two episodes of “Clarity”:

    Thanks Harry and Jonathan for the great videos!

  • Visio Insights

    Creating custom validation rules for Visio 2010


    In our last post, we discussed Diagram Validation—a new Visio 2010 feature which allows users to check their diagrams for common errors and allows companies to ensure that employees are following certain diagramming standards. In this post, we’ll talk more about how validation rules are stored and how to create custom validation rules.

    With Visio 2010, we provide diagram validation support for Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow and Business Process Modeling Notation diagrams. We also provide an extensive validation API for creating custom validation rules. The supported functionality includes adding and deleting rules and rule sets, directly manipulating validation issues, triggering validation, and detecting the validation event. This support allows companies to develop custom validation rules to meet their own needs.

    At a high level, validation rules belong to rule sets, such as the Flowchart and BPMN rule sets. To see which rule sets are available in your current diagram, click the Check Diagram pull-down menu on the Process tab, and then click Rules to Check. Rule sets with a checkmark beside them are active—rules from these sets will be evaluated during validation. Clicking on a rule set will toggle it between active and inactive.


    There are two main approaches to creating custom validation rules and rule sets.

    1. You can write validation rules and validation logic that will be stored in a custom Visio template. These rules are automatically available to users that create diagrams based on this template. When a user clicks Check Diagram on the Process tab, Visio uses the validation logic provided to determine whether the diagram has issues. In Visio 2010, this technique is used for the Basic Flowchart, Cross Functional Flowchart and Business Process Modeling Notation templates.

    2. You can also write validation logic in code and deploy this logic as part of a Visio solution. For this approach, the solution code listens for the appropriate RuleSetValidated event and uses its own logic to determine the list of issues to add to the document. In Visio 2010, this technique is used for the Microsoft SharePoint Workflow template.

    In both cases, the validation rules and corresponding rule sets are stored inside your Visio file. To see how these rules are stored, you can save a Visio file with validation rules as an XML Drawing (*.vdx) and open the XML Drawing in an XML editor. A search using the keyword “validation” will lead you to the XML related to validation. In the image below, a section of the XML for the Flowchart rule set is shown.


    Notice that each rule in the Flowchart rule set contains a RuleFilter and RuleTest property. These properties define the logic that Visio uses to determine whether a rule applies to a particular Visio object, and whether the rule is satisfied by the object. The syntax for each logic expression is the same as a ShapeSheet expression, but the allowable functions differ slightly. You can see many examples of valid RuleFilter and RuleTest expressions in our Flowchart and BPMN rule sets.

    If you save a Microsoft SharePoint Workflow diagram as an XML Drawing (*.vdx) and open the XML Drawing in an XML editor, you will see that there is no logic in the RuleFilter and RuleTest expressions. In this case, the solution contains code with the validation logic. The SharePoint Workflow solution listens for the SharePoint Workflow RuleSetValidated event, and, when this event occurs, it scans the diagram to determine if there are issues. When an issue is found, it uses the validation API to add the issue to the document. Visio automatically displays these issues in the Issues Window.


    Although you can modify the validation properties directly in the XML, we suggest that developers use the validation API to manipulate rules programmatically. You can use Visual Basic for Applications, accessible through the Developer tab, and its Object Browser to view the validation API. The key objects, methods and properties for validation are shown below.


    There is a lot more that can be said about creating custom validation rules, but hopefully this post gives you a good sense of the options available for using Diagram Validation. The following list summarizes these options.

    1. End-users and companies can use the default rules provide in Visio 2010 to check their diagrams for issues and ensure diagram consistency. Out-of-the box support is included for Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow and Business Process Modeling Notation diagrams.

    2. Developers can extend the out-of-box support by creating custom templates with validation rules. These rules are available to users who create diagrams from these templates.

    3. Developers can create Visio solutions that listen for the validation event. When the Check Diagram button is clicked, the solution can run code to validate complex logic and use the validation API to add issues to the list of issues displayed in the Issues Window.

    4. Developers can create Visio solutions that trigger validation from within their code. This allows solutions to make use of validation without relying on a click of the Check Diagram button. For example, the Microsoft SharePoint Workflow template triggers validation when a user clicks the SharePoint Workflow button Export on the Process tab.

    We’re interested to hear your feedback, so use the Send a Smile feedback tool or comment on this post to let us know what you think.

  • Visio Insights

    Themes and Live Preview in Visio 2010


    In Visio 2007, we introduced the Themes feature to make it easy to apply a professionally designed look to a diagram. In Visio 2010, the Themes feature gets a whole new user interface that takes advantage of the Office Fluent UI. The theme choices are displayed in a gallery on the Design tab in the ribbon.


    An improvement over Visio 2007 is that you can apply both theme colors and effects with one click on a thumbnail in the main Themes gallery, instead of having to visit two separate task panes. Each thumbnail is a pairing of a color scheme from the Colors gallery and an effect scheme from the Effects gallery.

    As in Visio 2007, the color schemes include colors for text, fills, lines, connectors, shadows, and backgrounds, as well as a collection of five accent colors. The effect schemes include the font used in text, as well as formatting for the fills, lines, connectors, and shadows.

    If none of the theme pairs in the main gallery are to your liking, you can choose from any of the schemes in the Colors or Effects galleries, which are located next to the main gallery.


    As in Visio 2007, you can also click “Create New Theme Colors” or “Create New Theme Effects” at the bottom of the gallery to create your own custom theme.

    Live Preview

    Themes is one of the features that demonstrate the Live Preview capability of the Office Fluent UI. As you move the cursor over each thumbnail in the gallery, the theme’s formatting is previewed on your diagram. This lets you quickly experiment with various looks without forcing you to commit to the change. If you don’t click on anything, the diagram reverts back to whatever was applied before the preview.


    Live Preview helps break the repetitive “Undo” cycle of applying formatting to content, deciding against the formatting change, choosing Undo to return to the original formatting, and then starting the cycle all over again.

    Live Preview is available for many other galleries and menus in Visio 2010. Another feature that makes good use of it is the Containers feature discussed in an earlier post. When you move the cursor over the various container designs in the Container gallery on the Insert tab, the container style is previewed on the selected shapes so you can see what it would look like if applied.

    Insert Container

    If you’re running the Visio 2010 Technical Preview, check out the new Themes user interface and Live Preview and let us know what you think via Send a Smile or a comment on the blog.

  • Visio Insights

    The Visio 2010 Connectivity API


    Our previous post on AutoConnect in Visio 2010 discussed how Visio 2010 makes it simpler and faster for end users to create connected diagrams such as flowcharts. Many developers will be pleased to hear that Visio 2010 also brings greatly simplified utilities for working with connected diagrams programmatically. The Visio 2010 API contains new methods that let developers manipulate and traverse connected diagrams or graphs at a higher level of abstraction than previously, which can result in greater programmer productivity and more concise, readable code.

    In this blog post, we will introduce the new Visio 2010 methods used for working with connected diagrams. Then we will see these methods in action by doing a visual walk-through of a program that manipulates a flowchart. (The source code and diagram used below are also available for download here.)

    New connectivity methods in Visio 2010

    For each of the following API methods, we give a brief description on what the method does, along with an explanation of the method’s arguments. This is not meant to be a complete reference; the forthcoming Visio 2010 SDK will contain much more complete documentation on these methods.

    Shape.ConnectedShapes(Flags, CategoryFilter)

    Returns an array of identifiers (IDs) of shapes that are one degree of separation away from the given shape (i.e. separated by a 1-D connector).


    • Flags: Filters the list of returned shape IDs by the directionality of the connectors.
    • CategoryFilter: Filters the list of returned shape IDs by limiting it to IDs of shapes that match the specified category. A shape’s categories can be found in the User.msvShapeCategories cell of its ShapeSheet.

    Shape.GluedShapes(Flags, CategoryFilter, pOtherConnectedShape)

    Returns an array of identifiers for the shapes that are glued to a shape. For instance, if the given shape is a 2-D shape that has multiple connectors attached to it, this method would return the IDs of those connectors. If the given shape is a connector, this method would return the IDs of the shapes to which its ends are glued.


    • Flags: Specifies dimensionality and directionality of connectors of shapes returned.
    • CategoryFilter: Specifies category of shapes returned.
    • pOtherConnectedShape: Optional additional shape to which returned shapes must also be glued

    Page.DropConnected(ObjectToDrop, TargetShape, PlacementDir, [Connector])

    Creates a new Shape object on the page, places the new shape relative to the specified existing target shape, and adds a connector from the existing shape to the new shape. Returns the newly created shape. This feature parallels the AutoConnect feature in the Visio user interface.


    • ObjectToDrop: The shape to be added to the page
    • TargetShape: The existing shape from which to align, space, and connect
    • PlacementDir: The direction from TargetShape in which to place ObjectToDrop
    • Connector: The connector to use (optional). This overrides usage of the default Dynamic Connector.

    Page.SplitConnector(ConnectorToSplit, Shape)

    Splits the specified connector with the specified shape. Returns the new, duplicated connector.


    • ConnectorToSplit: The connector to split. Must be a routable 1-D connector.
    • Shape: The shape to use to split the connector. Must be a 2-D shape.

    Shape.Disconnect(ConnectorEnd, OffsetX, OffsetY, Units)

    Unglues the specified connector end points and offsets them the specified amount from the shapes they were joined to.


    • ConnectorEnd: The end of the connector to disconnect
    • OffsetX: The x-distance that the connector end is moved away from the shape
    • OffsetY: The y-distance that the connector end is moved away from the shape
    • Units: The units of measure for the assigned offset values

    Page.AutoConnectMany(FromShapeIDs(), ToShapeIDs(), PlacementDirs(), [Connector])

    Automatically draws multiple connections in the specified directions between the specified shapes. Returns the number of shapes connected.


    • FromShapeIDs(): An array of identifers of the shapes from which to draw a connection
    • ToShapeIDs(): An array of identifers of the shapes to which to draw a connection
    • PlacementDirs(): An array of constants that represent the directions in which to draw the connection
    • Connector: The connector to use (optional). This overrides usage of the default Dynamic Connector.

    Let’s try it out!

    Here is a screenshot of a Visio drawing we will be manipulating and traversing:


    Using a few of the above listed methods, we’ll add to this flowchart and traverse it. Each step along the way, we’ll show you the corresponding line of C# code along with a screenshot of the change it caused.

    Note: In the below code snippets, page refers to the active drawing page, and the Visio namespace is an abbreviation of Microsoft.Office.Interop.Visio. The meanings of most other variables should be apparent from the context.

    First, let's split the connector that currently connects "Start Event" to "Task" and insert a Sub-Process shape. We can access that connector using the GluedShapes method. Once we’ve accessed the connector, we use SplitConnector to split it.

    Array shapesGluedToStartEvent =
        startEvent.GluedShapes(Visio.VisGluedShapesFlags.visGluedShapesOutgoing1D, "", null);
    // In this example, the above array has 1 element. Let's get that element.
    int splittableConnectorID = (int)shapesGluedToStartEvent.GetValue(0);
    Visio.Shape splittableConnector = page.Shapes.get_ItemFromID(splittableConnectorID);
    page.SplitConnector(splittableConnector, subprocessMaster);

    This yields the following result:


    Let's say we want to programmatically access the "Task" shape. If we have a reference to "Start Event", we can access "Task" by traversing across "Sub-Process", using ConnectedShapes.

    Array shapesConnectedToByStartEvent =
        startEvent.ConnectedShapes(Visio.VisConnectedShapesFlags.visConnectedShapesOutgoingNodes, "");
    // In this example, the above array has 1 element. Let's get that element.
    int subProcessID = (int)shapesConnectedToByStartEvent.GetValue(0);
    Visio.Shape subProcess = page.Shapes.get_ItemFromID(subProcessID);

    // Repeating the same action as above to get from "Sub-Process" to "Task".
    Array shapesConnectedToBySubProcess =
        subProcess.ConnectedShapes(Visio.VisConnectedShapesFlags.visConnectedShapesOutgoingNodes, "");
    int taskID = (int)shapesConnectedToBySubProcess.GetValue(0);
    Visio.Shape task = page.Shapes.get_ItemFromID(taskID);

    Now let's use DropConnected to drop an End Event shape onto the page and have "Task" connect to it. We use the default connector, so the last argument can be null.

    Visio.Shape endEvent = page.DropConnected(endEventMaster,

    This yields the following result:


    We hope this walk-through was a helpful illustration of Visio 2010’s new API utilities for working with connected diagrams. This article covers only a small part of the enhancements made to Visio’s API for the 2010 release; more information will come in future posts on this blog, and with the release of the Visio 2010 SDK.

    We’re interested to hear what developers think of this API functionality, so please use the Send a Smile feedback tool or leave a comment below.

  • Visio Insights

    SharePoint Conference 2009


    The Visio team is anxiously preparing to introduce Visio Services to the world at the Microsoft SharePoint Conference 2009, which runs from October 19th to 22nd, 2009 in Las Vegas.

    Visio Services is a new SharePoint feature that allows you to share Visio drawings across your organization in SharePoint. But it does more...

    If you're interested in hearing what, register for the conference and come listen to our talks. Don't worry if you can't make it -- in the coming months, we'll be presenting conference highlights on the blog as well as an in depth look at Visio Services features.


Page 1 of 1 (11 items)