A docked stencil opens in the instance of the Visio 2003 ActiveX control that was last active when you use the OpenEx method in Visio 2003 (885121)
The information in this article applies to:
- Microsoft Office Visio Professional 2003
- Microsoft Office Visio Standard 2003
SYMPTOMSYou create a custom program that uses multiple instances of the Microsoft Office Visio 2003 ActiveX control, also known as the Microsoft Visio drawing control.
If you use the OpenEx method to open a docked stencil in the custom program, the stencil opens in the last Visio drawing control that was active. Additionally, there is no way to make a different instance of the drawing control open the stencil. The following is an example of Microsoft Visual C# .NET code that demonstrates the symptoms that you experience: axDrawingControl1.Document.Application.Documents.OpenEx("Basic_U.vss",(short)Visio.VisOpenSaveArgs.visOpenDocked);
axDrawingControl2.Document.Application.Documents.OpenEx("Basic_U.vss",(short)Visio.VisOpenSaveArgs.visOpenDocked);
CAUSEThis issue occurs because multiple instances of the Visio 2003 drawing control use the same instance of the application object. In the code example that is in the "Symptoms" section, the application object that is returned by the axDrawingControl1.Document.Application code is the same object as the application object that is returned by the axDrawingControl2.Document.Application code.
When you use the OpenEx method to open a stencil, the code does not contain a reference to tell Visio 2003 which instance of the drawing control to use to open the stencil. Therefore, Visio 2003 cannot determine the instance of the drawing control where you want to open the stencil. You have to set the focus on the instance of the Visio drawing control where you want to open the docked stencil before the stencil opens in that particular instance.WORKAROUNDTo work around this issue, set the focus on the instance of the Visio drawing control where you want to open the docked stencil before you use the OpenEx method to open the stencil. The following is an example of code that demonstrates this workaround. Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Note The sample code in this article uses Visual C# .NET. axDrawingControl1.Focus();
axDrawingControl1.Document.Application.Documents.OpenEx("Basic_U.vss",(short)Visio.VisOpenSaveArgs.visOpenDocked);
axDrawingControl2.Focus();
axDrawingControl2.Document.Application.Documents.OpenEx("Basic_U.vss",(short)Visio.VisOpenSaveArgs.visOpenDocked);
Modification Type: | Major | Last Reviewed: | 7/1/2005 |
---|
Keywords: | kbnewfile kbopenfile kbprb kbtshoot KB885121 kbAudITPRO kbAudDeveloper |
---|
|