Visio 2003 Developer's Survival Pack Tools and Samples

Chapter 29: Drag and Drop and IDataObject (.NET, C#)
Visio 2003 DSP home   This page

Overview

The purpose of this sample is illustrate some Drag and Drop and IDataObject concepts using a .NET Form in C#. The main application is very similar to the Generic_DotNET application using a Visio Drawing Control, as described in Chapter 26.

Installation

This sample obviously requires Visual Studio .NET. I used VS.NET 7.1, with .NET Framework 1.1, plus the Visio Drawing Control and its Primary Interop Adapter.

Files

File Description
IDataObjectDragDrop.sln Solution object for this chapter. Double-click on this file to start Visual Studio .NET and load the solution and its one project, StencilReplace.
Form1.cs The main form on which is located an instance of the Visio Drawing Control, a list which will represent the "replacement stencil, and some other features.
Many other files As you are no doubt aware, a VS.NET project involves quite a few miscellaneous files
StencilReplace\bin\Debug\
StencilReplace.exe
The actual executable resulting from the project.
StencilReplace\bin\Debug\
MyStartDoc.vdx
A startup doc which the example program loads. This should be in the same directory as the project's exe file.

Operation

You can run the application either from within the VS.NET IDE, or by launching the exe from Windows Explorer.

Try the following exercises.

Exercise Description
Steps like in the Generic_DotNET sample ... should work the same.
Populate List button Should read the Basic Shapes stencil and list its masters in the List control.
Now try dragging items from the list to the drawing page.
Add VDX Shapes button Adds a couple of additional items to the list, which demonstrate dragging a shape whose data is provided to Visio in VDX form.

 


Article Created: 2003-09-01  Last edit: Last edit: 03-10-14 Graham Wideman
Go to:
  DiagramAntics.com