Microsoft KB Archive/931403

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


A stencil opens in only the first instance of the Visio Drawing Control when you use the OpenEx method on a form that contains multiple instances of the Visio Drawing Control

Article ID: 931403

Article Last Modified on 10/15/2007



APPLIES TO

  • Microsoft Office Visio Standard 2007
  • Microsoft Office Visio Professional 2007
  • Microsoft Office Visio Professional 2003
  • Microsoft Office Visio Standard 2003



SYMPTOMS

You create a custom application that uses more than one Microsoft Office Visio Drawing Control on a form. When you use the OpenEx method together with the visOpenDocked flag to open a stencil, the stencil is opened in only the first instance of the Visio Drawing Control on the form. You cannot open the stencil in all instances or in a particular instance of the Visio Drawing Control.

For example, you experience these symptoms when you use the following code to open the Basic Shapes stencil:

axDrawingControl1.Document.Application.Documents.OpenEx("Basic_U.vss",(short)Visio.VisOpenSaveArgs.visOpenDocked);  
axDrawingControl2.Document.Application.Documents.OpenEx("Basic_U.vss",(short)Visio.VisOpenSaveArgs.visOpenDocked);  

CAUSE

The OpenEx method together with the visOpenDocked flag creates a docked stencil window in an active window if the active window is a drawing page window. An instance of the Visio application can only have one active multiple document interface (MDI) window at a time. Multiple instances of the Visio Drawing Control share the same underlying application instance. In this scenario, each instance of the Visio Drawing Control can be regarded as a MDI window.

RESOLUTION

Specify the instance or instances of the Visio Drawing Control that you want to use as the active window. To do this, set the focus on the control object or objects before you use the OpenEx method together with the visOpenDocked flag to open a stencil.

The following is an example of code that opens the Basic Shapes stencil in two instances of the Visio Drawing Control:

axDrawingControl1.SetFocus();
axDrawingControl1.Document.Application.Documents.OpenEx("Basic_U.vss",(short)Visio.VisOpenSaveArgs.visOpenDocked);  
axDrawingControl2.SetFocus();
axDrawingControl2.Document.Application.Documents.OpenEx("Basic_U.vss",(short)Visio.VisOpenSaveArgs.visOpenDocked);  

MORE INFORMATION

For more information about the Visio Drawing Control in Visio 2007, see the Microsoft Office Visio 2007 Software Development Kit (SDK). To obtain the Visio 2007 SDK, visit the following Microsoft Web site:

For more information about the Visio Drawing Control in Visio 2003, visit the following Microsoft Web site:


Additional query words: vso2003 visio2003 vso2007 visio2007 activeX

Keywords: kbtshoot kbprogramming kbprb kbexpertiseinter KB931403