About the Visio 2003 Managed Code Interop Tutorial [Visio 2003 SDK Documentation]
Welcome to the Microsoft® Visio® Managed Code Interop tutorial. The Microsoft Visual Basic® .NET projects that accompany these lessons can be found in the SDK install directory at \Samples\Tutorial\VBNet\.
This tutorial describes how to build a Visio solution written in Visual Basic .NET. We demonstrate this process and show the code required to create a Visio Component Object Model (COM) add-in in Visual Basic .NET, handle events, gather input via a wizard interface to generate a drawing, and enhance performance. Each lesson topic contains a Visual Basic .NET sample application that implements the topic functionality. Each lesson's application can be compiled into a COM add-in that runs in Visio 2003. Each lesson's application demonstrates how to incrementally add the topic functionality for the lesson to the functionality in the previous lesson's application.
Lessons 2, 3 and 4 of this tutorial use stencils installed as part of the Visio 2003 flowchart solution. The Visio flowchart solution is installed with a typical installation of Visio. If you choose a custom installation and do not install the Flowchart solution, then the stencils required for the tutorial are not available. You can install the flowchart solution by adding the feature from your original Visio 2003 installation CD.
This tutorial consists of documentation and Visual Basic .NET projects that support the topics described in the following lessons:
- Lesson 1: Visio COM Add-in Creation in Visual Basic .NET This lesson describes the basic steps for building a Visio COM add-in built with Visual Basic .NET. The resulting add-in serves as the basis for the Visio 2003 Managed Code Interop Tutorial sample application, which is developed in the subsequent lessons. This lesson also summarizes the key information learned from implementing a COM add-in in Visual Basic .NET versus Visual Basic 6.0.
- Lesson 2: Event Handling In this lesson we add functionality to the COM add-in that we wrote in Lesson 1: Visio COM Add-in Creation in Visual Basic .NET. This functionality enables the COM add-in to respond to a user creating a new Visio document.
- Lesson 3: Data Input In this lesson we extend the COM add-in from Lesson 2: Event Handling to invoke a wizard that gathers user preferences for creating a simple flowchart. Through the wizard, the user can determine the number of flowchart shapes to draw and modify shape properties. We extend the DocumentCreator class from the previous lesson so that the COM add-in creates a DocumentCreator object using the wizard data. We demonstrate extending the COM add-in to get user input from a wizard implemented using Microsoft Windows® Forms and create a flowchart.
- Lesson 4: Performance As shown in Lesson 3, the TutorialAddin sample wizard allows the user to customize the shape master and properties such as shape text, fill color, line color, and hyperlink. Instead of setting shape properties individually on the Shape object, resulting in two calls per property for each shape, you can use the Visio SetFormulas method to modify ShapeSheet® cells in a single call by specifying an array of values and cells.