Mark Bukovec
Empire Down DevelopmentSeptember 2003Applies to:
Microsoft(R) Workplace Visio(R) 2003Summary: Learn to integrate the Microsoft(R) Workplace Visio(R) 2003 ActiveX(R) Control, also referred to as the Visio drawing manage, into programs. Critique ideal practices and how to implement the Visio drawing command programmatically. (24 printed pages)Contents Introduction Understanding the Visio Drawing Management Situations for Using the Visio Drawing Handle Layout Best Practices Acquiring Started Integrating the Command along with the Host Container Deployment ConclusionIntroduction The Microsoft(R) Workplace Visio(R) 2003 ActiveX(R) Handle (Visio drawing command) features the total performance in the Visio software with the prosperous Visio object model, as an embeddable part. You can actually drive the Visio drawing command programmatically by activities or by code inside your hosting software. Alternatively, the Visio drawing control can offer a diagramming atmosphere for application users inside the context of the personal application's consumer interface (UI). In this particular review, you certainly will master: The elements with the Visio drawing control and example use scenarios. Finest practices for applying the Visio drawing manage in Visio answers. Learn how to embed the Visio drawing handle in the wide variety of host programs, which include Microsoft Windows(R) Forms, Microsoft Visual Basic(R) 6.0 varieties, Microsoft Workplace paperwork, and Microsoft Internet Explorer. Easy methods to make use of the properties for the Visio drawing handle API. Tips on how to load Visio paperwork in to the drawing command window and preserve improvements. Easy methods to obtain a reference towards the Visio Software object as a way to do the job programmatically with all the Visio document. Find out how to deal with the exhibit in the drawing surface. Easy methods to integrate the management together with your host software user interface. Tips on how to deploy the Visio drawing control with your software. Comprehension the Visio Drawing Command The Visio drawing command gives you the performance on the Visio application object model inside a element. The Visio drawing command may be embedded in host applications designed utilizing Microsoft Visual Studio(R) .NET 2003, Microsoft Office XP and Microsoft Workplace 2003 containers such as Microsoft Workplace Phrase 2003, Microsoft World-wide-web Explorer 5.0 and later on, and other Microsoft ActiveX(R) control containers. After extra,
microsoft office Home And Student 2010 64 bit, the Visio drawing control can provide a drawing surface for displaying designs.The Visio drawing command makes it possible for the developer to supply Visio features within the context of an additional application. This new degree of integration helps the developer total handle above the Visio consumer interface integration with the host application. The new performance gives even more power than simply purely embedding a Visio drawing into an OLE container document, like Phrase. Making use of a Visio drawing as an OLE object enables you to watch the diagram inside container software, hyperlink the OLE object to the actual Visio document to reflect modifications, and edit the Visio drawing by activating the Visio application from inside the container document.While in the case of in-place OLE activation, you happen to be still functioning in the Visio person interface. You can't establish your own private UI. You can't programmatically accessibility the Visio document working with Automation from the containing software. You're also restricted to software hosts that apply an OLE container, which guidelines out technologies such as .NET Windows Varieties. The Visio drawing handle, in spite of this, gives you new features to handle these scenarios, and allows you to produce new Visio solutions that weren't earlier achievable, for example individuals described inside the subsequent section of this informative article, "Scenarios for By using the Visio Drawing Command."The Visio drawing management is distributed through the Visio item setup. There is certainly also a main interop assembly to choose from for managed-code access to the Visio drawing control API. If you would like to make use of the management from managed code, you have got to install the Visio key interop assemblies. See the Deployment section of this article for facts on putting in the Visio drawing management plus the Visio primary interop assemblies.Scenarios for Working with the Visio Drawing Control To show the utility in the Visio drawing command, consider the subsequent client situations. A company's facilities division will provide an workplace space-planning application for administrative assistants. A Windows Sort hosts the drawing control, which displays a place representing the layout with the office. Future to the drawing handle are buttons representing workplace furniture. When the administrative assistant clicks a button, a shape is dropped on the drawing kind, which he can then reposition with the drawing handle to discover how the furniture arrangement appears inside the workplace. The Windows Kind incorporates an occasion handler, composed in Visual Basic .NET, which responds to a brand new shape becoming added and tracks the furnishings choices to generate a select purchase. The administrative assistant can rearrange and eradicate the furniture choices by deleting shapes from the drawing control. Because the administrative assistant is driving the drawing surface from your form's UI, the person doesn't have to get acquainted with all the Visio software. A management team is operating on the flowchart to map out employee processes. To assist collaboration, the staff employs Microsoft Workplace SharePointTM Portal Server, which provides a central storage stage for group documentation and equipment for collaborating and sharing documents. The managers aren't acquainted with drawing resources and would have a preference for to enter plan procedures within a Microsoft Workplace Excel spreadsheet and have Visio create the flowchart drawing from that data. On top of that, they'd want to see all their data on the same exact browser page. To apply these necessities, the software developer modifies the crew page about the SharePoint web-site by incorporating a info sheet Website Element that displays the Excel spreadsheet for defining the process techniques. Then the developer produces a custom World wide web Component that hosts the drawing control. The developer backlinks the two Net Parts with each other as well as a flowchart is automatically created inside the drawing handle in the operation action data in Excel. If a supervisor desires to modify the flowchart, she edits a row during the data sheet World wide web Part,
microsoft office 2010 Home And Student 32 bit, in addition to the flowchart designs are refreshed to reflect the adjustments. This solution helps the managers to try and do all their updates inside the exact same browser page and do the job together with the tools they can be most pleasant employing.
The management lets you establish event-driven applications such as the ones just described implementing a variety of host containers. Rather than making a solution which is hosted within the Visio software person interface, you could add the drawing surface component to your current or planned application. With the case of the Visio drawing command, the application usually reflects the architecture demonstrated in Figure one.Figure one. Software hosting the Visio drawing controlUsing the Visio drawing handle with your application allows for the subsequent positive aspects: The Visio drawing handle runs in-process together with your software and doesn't involve a separate instance of your Visio software to become running. The control displays just one Visio document and single window per instance. You can actually show a variety of documents by embedding various handle situations within the host software. The Visio drawing management also exposes a strategy for loading an current Visio file. The command allows for person interface integration together with the host software. Developers can provide a simplified person interface for users unfamiliar with Visio. The host software can accessibility Visio Automation properties and procedures with the embedded handle instance. This permits the host application to programmatically modify the contained Visio document. The command straight exposes Visio Window and Document events. You can even acquire a Visio drawing manage answer utilising managed code. Managed code interoperability is furnished through the Visio primary interop assemblies, which furnish managed-code access towards the Visio drawing manage API as well as Visio Automation library. Just before the drawing control, for managed code you could only create a COM add-in or executable applying a managed language. With the control, it is easy to execute Visio Automation code straight from your application. This integration allows you to use Windows Varieties as an software container and code in managed languages which include Visual Studio C++, Visual.NET C# or Visual Fundamental .NET.Design Very best Practices Because the Visio drawing control can be described as programmable element, you'll be able to integrate your Visio method code directly in to the host container application. In past releases of Visio, a developer composing a solution for the Visio client software needed to package deal the option code in a very COM add-in, Visio method library (VSL), out-of-process executable, or within a Visual Common for Applications (VBA) challenge in the document. The Visio handle simplifies alternative architecture as well as the enhancement system by letting programming on the Visio Application object in the hosting software. A developer by using the control in a customized application (such as a C# software) or World wide web Explorer really should program versus the Visio object design right with the host application, devoid of separating the Visio logic right into a COM add-in, VSL, or executable. Calling a Visio COM add-in, VSL, or executable from the hosting application unnecessarily complicates the debugging of the Visio integration. Having said that, if you should would like to host the Visio command in a very Microsoft Workplace Strategy software aside from Visio, you'll have to use a COM add-in. In this particular situation, generate a COM add-in for your personal host application as an alternative to for Visio. One example is, if you should prepare to host your Visio command in a Microsoft Workplace Word 2003 document, construct a Word COM add-in and entry the Visio management through the Phrase add-in. Ensure your COM add-in is targeted at the host due to the fact an Workplace host application will never load a Visio COM add-in for that drawing handle.Functioning with Management Host Restrictions The Visio drawing control supports countless containers, this includes hosting programs constructed in Visual Studio. NET 2003, Visual Studio 6.0, Net Explorer 5.0 or later, ASP.NET, along with other ActiveX control containers. In spite of this, the Visio manage can not be specifically embedded in: A second ActiveX control, just like the Online world Explorer browser control. A Visio document. A Microsoft Office InfoPathTM 2003 sort. Note You'll be able to embed ActiveX controls in to the Visio drawing control (rather than the Visio drawing control embedded in one more ActiveX command). Nevertheless, because the Visio drawing command will not execute VBA code within a Visio document, it can be much better to integrate other ActiveX controls to the host software venture rather then the Visio document. Implementing the Visio Management with all the Word wide web Explorer Browser Control Although you can not embed the Visio drawing management directly into one other ActiveX management, you’re able to nevertheless make use of the Visio drawing command with programs that rely on the web Explorer browser handle. Internet Explorer five.0 or later supplies a great host container for your Visio drawing management, making it possible for developers to write script versus the Visio object design in Microsoft Visual Important Scripting Edition (VBScript) or ECMAScript as defined from the specification in the European Pc Manufacturers Association, for example JScript or JavaScript. To integrate the Visio drawing management with an internet Explorer browser control-based software, for example the Microsoft Workplace Task Web Accessibility client, do the subsequent: Add a hyperlink with your World wide web Explorer browser control that launches a new Web Explorer technique with its individual window. Embed the Visio drawing command with the new Online world Explorer window for your new Web Explorer procedure. System against the Visio drawing management making use of your chosen scripting language. Utilising the Visio Control with Microsoft Office InfoPath 2003 Whilst you can not embed the Visio drawing manage right onto an InfoPath 2003 sort, InfoPath gives an answer job pane containing an internet Explorer window. You may embed the Visio drawing management specifically into the InfoPath remedy undertaking pane window and utilize the Document Object Design (DOM) to share data between the Visio drawing in addition to the InfoPath sort.Comprehending the Visio Drawing Control's SDI When developing an application that utilizes the Visio drawing manage, it really is very important to comprehend that the Visio command supports just one document within a single window. The control's single document interface (SDI) architecture leads to the following considerations when developing the Visio drawing handle integration along with your software: Use a variety of occasions with the Visio drawing management to exhibit different Visio paperwork in the application. In contrast to the Visio consumer software, which can exhibit a variety of documents and windows at a time, the Visio drawing management can only screen a single document per instance with the control. When the developer really wants to exhibit many Visio paperwork, the developer can embed multiple instances in the command during the software, with each instance loading a separate Visio document. Usually do not depend on VBA for programming logic. VBA shouldn't be integrated with the Visio drawing command. As a consequence, documents loaded in the Visio drawing management will not execute any VBA code linked using the document. The control's lack of a VBA run-time surroundings prevents the distribution of authentic code or malicious macros by way of documents loaded through the Visio manage. Additionally, it means that the consumer of an software hosting the management will rarely see the Visio application's security dialog box warning about macros while in the document. Utilize the Visio ShapeSheet(R) programmatically. The management won't provide access on the Visio ShapeSheet user interface, which is a separate window in the Visio software. Yet, the ShapeSheet by itself nonetheless exists for that Visio styles and pages while in the document loaded while in the Visio drawing command. You’re able to nevertheless edit ShapeSheet cells in your Visio document inside the handle using Visio Automation. For instance, you can make use of the Cell object's SRC property to add a double-click action for a Visio shape. Be aware When you are programming the ShapeSheet for paperwork loaded with the management, you will not be able to work with the CALLTHIS function, which calls a VBA macro in the document. The Visio drawing control does not execute VBA code, so any use of the CALLTHIS operate fails silently. Instead, you could utilize the mouse events for your Visio Page and Document objects and handle the occasion response as part of your customized container software logic. (For more details about mouse events, see Dealing with Activities.) When you are using a COM add-in, you may also make use of the QUEUEMARKER perform to queue a marker celebration to the double-click event with the ShapeSheet. Porting Existing Visio Answers After you are porting your code from an present Visio consumer software resolution towards the Visio management, can include these style and design things to consider with your considering. Port VBA code. You should port all existing VBA code into a COM add-in, or even more ideally, your host application. You can keep a majority of your exact same algorithms and logic, provided that it makes sense doing work in the control's SDI architecture. Port an present Visio solution COM add-in, executable, or VSL to your container software. When it might be in the beginning more convenient to basically use an current COM add-in, executable, or VSL with all the host software, it happens to be advised you integrate the Visio drawing management programming directly along with the host software. By taking the time for you to port your code from your current option for your host software, you may simplify deployment of your resolution, and streamline the enhancement, debugging, and servicing process with time. You don't should use a COM add-in unless you will be doing work with all the management in an additional Workplace container. Re-evaluate information storage in styles. If your existing Visio resolution retailers intensive information in designs, give consideration to re-architecting information storage out of Visio shapes and into data structures maintained or accessed from the host application. Visio can store as quite a bit data as you might need, nonetheless it typically can make much more feeling to keep Visio as being a presentation layer component and use your host application as information storage or accessibility to a info source. When the information is comparatively static, although, and implemented seriously for modifying the physical appearance and layout of shapes, it tends to make additional sense to keep the data while in the form customized properties. Contemplate occasion integration together with the host application. In contrast to a Visio customer application method, the Visio drawing surface can respond to both person events and host application activities. Give consideration to the way you want the drawing surface to reply to activities fired from the host application, and how your host application must have to respond to activities with the Visio drawing surface. Use marker events for COM add-ins. If you ever have to use a COM add-in, you will need a way to notify your COM add-in to respond to a person action within your document. Utilize the QUEUEMARKER purpose inside the ShapeSheet or perhaps a persistent celebration with the document to queue a marker occasion to which your COM add-in responds. Starting up New Visio Advancement If you should are just starting Visio integration with an application, it's preferred to program right against the Visio object design with your host application code. On top of that on the design and style information and implementation tips during this document, seek the advice of these sources for knowledge on using the Visio object product: Microsoft Workplace Visio Automation Reference Will provide technical documentation about the Visio object product. Microsoft Office Visio ShapeSheet Reference Presents technical documentation on ShapeSheet cells and features that you may plan with the Visio object product. Visio Developer Middle on MSDN Gives you content, tutorials, and also a software program growth kit (SDK) for Visio developers of all ranges. Obtaining Began This section addresses the fundamental simple steps for making use of the Visio drawing control as part of your software. It describes the best way to embed the handle in a very host container, the right way to load Visio documents into the management window and help save adjustments, and how to have a reference on the Visio Application object to ensure you're able to do the job programmatically with all the Visio document.Setting up a Visio Drawing Control Instance This section particulars the procedures for setting up Visio drawing control situations and setting references for the subsequent containers: Windows Types, Visual Fundamental six.0 form-based applications, Workplace documents, and World wide web Explorer.Note A developer won't be able to activate a Visio drawing within the Visio management at design time. Visio drawings inside handle activate at run time only. Creating a Visio Drawing Control Instance in Managed Code You possibly can immediately formulate a Visio drawing command instance in managed code.Finishing this technique to add the subsequent assembly references to your undertaking: VisioOcx The Visio drawing control primary interop assembly. Visio The Visio sort library key interop assembly. AxVisOcx An ActiveX command wrapper assembly that allows the handle to get embedded within a Windows Type. The Windows Varieties ActiveX Handle Importer (Aximp.exe) generates this assembly immediately and adds it to your task. This wrapper assembly have to be redistributed together with the application. Various Visio drawing handle situations on the type share identical wrapper class derived through the AxHost class. To add the Visio drawing manage to a Windows Sort In Visual Studio .NET, display the Windows Type in Structure mode. Click on the Toolbox. Right-click inside the Toolbox and decide on Add/Remove Products to open the Customize Toolbox dialog box. Click the COM Components tab from the Customize Toolbox dialog box. Decide upon Microsoft Visio Drawing Command for your type library, as proven in Figure 2.
Figure 2. Incorporating the Visio drawing command towards the Visual Studio .NET Toolbox Click on Okay. The Visio drawing management is now out there while in the Toolbox, as demonstrated in Figure 3.
Figure 3. Visio drawing handle while in the Visual Studio .NET Toolbox Add the Visio drawing control on the kind both by double-clicking it inside the Toolbox or by clicking it then dragging it for the form. Creating a Visio Drawing Command Instance in Visual Important 6.0 You can very easily build a Visio drawing manage instance employing Visual Essential 6.0. Completing this process to add a reference on the Visio drawing handle form library. If you'd like to programmatically transform the Visio document contained in the drawing command instance, you'll need to add a reference for the Microsoft Visio 11.0 Sort Library.To add the Visio drawing handle to a Visual Important 6.0 form In Visual Important 6.0, screen the type in Style mode, right-click the Toolbox, after which pick out Elements. Around the Controls tab while in the Components dialog box, select Microsoft Visio Drawing Control eleven.0, as proven in Figure 4.
Figure 4. Adding the Visio drawing control to your Visual Basic 6.0 Toolbox Click on Ok. The Visio drawing manage is now accessible inside Toolbox.
Figure five. The Visio drawing handle during the Visual Important 6.0 Toolbox Add the Visio drawing on the sort possibly by double-clicking it inside the Toolbox or by clicking it and then dragging it to your form. Setting up a Visio Drawing Manage Instance in Microsoft Office Procedure Application Document Completing this technique to add a reference on the Visio drawing control type library. If you want to programmatically change the Visio document contained with the drawing control instance, you will need to add a reference to your Microsoft Visio eleven.0 Variety Library.To add the Visio drawing handle to an Workplace application document Right-click the Office application's toolbar and decide upon Management Toolbox. Around the Command Toolbox toolbar, click the Additional Controls button, and after that choose Microsoft Visio Drawing Handle, as shown in Figure 6:
Figure six. Adding the Visio drawing handle for the Microsoft Office Phrase Toolbox Once inserting the Visio drawing management into an Workplace application document, you may see its properties by right-clicking it and selecting Properties. If you'd like to accessibility the Visio drawing control programmatically through the document's Visual Simple undertaking, right-click the command and go for See Code.Developing a Visio Drawing Control Instance in Web Explorer To add the Visio drawing management to a Net Sort or an HTML page, you can adhere to the method in Producing a Visio Drawing Manage Instance in Managed Code, except that you'll drag the Visio drawing management to your World wide web page in contrast to to a Windows Form. Visual Studio .NET adds the subsequent HTML on the Website page:Modifying the values within the Properties window updates the home tags for that Visio drawing handle instance. For instance, when you modify the Src house, Visual Studio .NET generates a tag much like the following:The Visio drawing manage is hosted being a client-side object and supports a constrained quantity of properties for scripting languages similar to VBScript. You possibly can script alterations to the properties exposed by the Visio drawing manage. But, you cannot entry the Visio object product implementing a scripting language, which implies you will not be able to programmatically improve the Visio document shown from the manage. The consumer could make variations on the Visio document by clicking the drawing surface.Note The handle will only initialize with the earliest thread of any presented Word wide web Explorer course of action. If you should would like to use a number of instances of your control in a web Explorer-based software, build a fresh World-wide-web Explorer course of action for each further instance from the manage and load the HTML page containing the handle inside the new Online Explorer operation. Receiving a Reference to your Visio Application Object You could access the Visio object model through the Visio drawing control's API. To have a reference for the Visio Application object, use either the drawing control's Document or Window house.One example is, the following C# code reveals the best way to obtain a reference to the Visio Software object employing the drawing control's Window residence:You're able to do the same factor utilising the subsequent Visual Fundamental 6.0 code:Managing Documents When the Visio drawing management is loaded, it displays a blank Visio drawing. If you need to display an current Visio document, the drawing handle exposes an Src property for loading a document in to the command. You'll be able to then make use of the document's SaveAs way to conserve any modifications.Loading a Visio Document Use the Visio drawing control's Src home to load a document to the handle. For instance, the following C# instance exhibits the best way to load a Visio drawing:You can actually load any Visio file sort using the Src residence (one example is, .vsd, .vdx, .vst, or .svg). The file may very well be stored locally or on a remote file server.The Visio control's Src home loads a duplicate for the file specified with the Src value. To persist the modifications with the control's document, it's essential to save the Visio document implementing the SaveAs process. Alternatively, you may persist modifications in-stream. In the two situations, even so, you do not modify the original document loaded by the Src house.Saving a Visio Document to File The control loads a copy from the file specified by the SRC house. The file loaded by way of SRC shouldn't be opened for read/write operations, and so can't be saved applying the Save method. To conserve modifications to your document loaded in the Visio drawing manage, get in touch with the document's SaveAs method. The following C# example reveals the way you can utilize the drawing manage Document residence to phone the SaveAs system:You can not use the SaveA###### system to preserve Visio 2003 documents to Visio 2002 format during the Visio ActiveX command. To conserve a drawing loaded from the Visio drawing management to Visio 2002 format, launch an invisible instance of Visio and get in touch with the SaveA###### approach in your own Visio software instance, as demonstrated within this Visual Important 6.0 code that saves a Visio 2003 drawing to the Visio 2003 file format:Saving a Visio Document inside Handle to Stream Developers could prefer to persist adjustments to a drawing with the Visio drawing command without having saving the drawing to disk. For instance, if a person modifies a Visio document in an embedded control in the Word document, the changes are misplaced once the consumer forwards that Word document in an e-mail message. When another consumer opens the document, the command loads the file specified from the Src house, overwriting any modifications. To persist variations in-stream to a Visio document in the handle Load the original document implementing the Visio control's Src house. Soon after the document loads, set the Src residence to an empty string. When the command is activated in its container document after the very first initialization, the manage displays the very last in-stream picture rather than the initial document specified from the Src property.Using Blank Documents from the Handle To load a blank drawing during the command when the handle is initialized for your very first time, set the Src home to an empty string. Still, if you want to emulate setting up a new blank drawing inside command right after loading an current drawing document, you've gotten 3 decisions: Choose all and delete all shapes inside the drawings. This tactic helps the developer to preserve any present styles inside at the moment loaded document. Load a brand new, blank document applying the Src residence. Dynamically destroy and reinitialize the Visio drawing management inside document. Integrating the Control using the Host Container You can modify the look on the Visio drawing handle as part of your application. By default, all Visio toolbars are turned off as well as stencil pane just isn't shown. You could choose how the drawing control surface appears by displaying scroll bars, rulers, or by shifting the window background color. The drawing handle exposes a PageSizingBehavior house that determines how the page is shown in the drawing manage window. You may opt for to resize the page in relation for the drawing control's size, or provide a see much like Visio, showing a part of the drawing page. Because the management only supports just one window, you cannot entry the ShapeSheet or windows for example icon editor and grasp and group editing. The page and form right-click menus are enabled by default. The constrained Visio UI for controlling shape behavior displays the intent of your manage to be tightly integrated using the container software. The most impressive tactic for permitting users to modify styles on a document will be to use a customized UI. On the other hand, if you want to utilize Visio menus and toolbars, the drawing management does assistance menu and toolbar merging along with the host software. Almost certainly, your Visio drawing manage software will likely be event-driven and reply to consumers clicking buttons or menu things contained within the software. The drawing management also exposes Visio occasions, in order that you’re able to reply to a user clicking inside the handle itself.Managing the Drawing Surface Exhibit It is possible to modify the physical appearance on the Visio drawing control's surface through the control's Window home. For example, the following C# code hides the drawing control's scroll bars:This illustration hides both equally the horizontal and vertical scroll bars. Other doable values for your VisScrollbarStates enumeration feature visScrollBarBoth (display the two scroll bars), visScrollBarHoriz (show horizontal scroll bar), and visScrollBarVert (display vertical scroll bar).By eliminating components from the Visio UI, you can make the drawing management glimpse alot more integrated inside your software. The following C# code hides the rulers:You can even alter on the shade on the window track record to suit the color scheme of one's application. By way of example, the following C# code sets the window track record colour to solid red:With this illustration, the ColorTranslator course is chosen to convert a .NET colour variety into OLE_COLOR form, that is the how Visio Automation specifies colours. Consumer Settings for the Visio Handle The Visio drawing manage shares precisely the same underlying Software object since the Visio consumer software. For this reason, if your person adjustments the application settings for the Visio customer application (which include turning the page qualifications blue), identical settings use to the Visio handle when running inside the hosting application. The Visio control's HostID home enables you to shop numerous consumer settings for the control inside the registry. To set the HostID home, use a string to indicate the identify with the subkey that may be designed inside the [HKEY_CURRENT_USERSoftwareMicrosoftOffice11.0VisioH osts] critical. Though you'll be able to use any string for your identify of your control's subkey, it really is most effective to use a GUID to guarantee uniqueness.The HostID residence is set at design and style time inside the manage Properties window, or programmatically in the host application code.Page Sizing and Zoom Use the Visio drawing control's PageSizingBehavior house to resize the page with respect on the control window. The default setting of this home (visNeverResizePages) presents a view just like that of Visio wherever a part of the page is viewable within the window. The following C# code illustration resizes the page to match the handle:When PageSizingBehavior is set to visResizePages, the page's designs commonly are not resized with respect to your page. Shapes continue to be situated relative on the coordinate program for the Visio page, which has its origin inside the lower left corner on the page. Sizing the page to fit within the management hides the page boundaries and it is helpful in circumstances wherever the manage is sized for the maximum extent on the drawing surface.To rescale the whole page, this includes its designs, in the drawing command window, set the Zoom property through the control's Window property, as shown from the subsequent C# example:This code magnifies the window's contents by 200%. To get effect, the zoom settings should be built once loading the document working with the Src property.To avoid the person from altering the zoom setting, set the ZoomLock residence as shown inside subsequent C# instance:You'll be able to set the extent to which Visio controls the zoom through the VisZoomBehavior house, which can be accessed through the drawing control's Window or Document house. By default, the handle utilizes the current zoom setting for your document. If you would like to be capable to set the zoom to any level, not only discrete settings including 50% or 100%, with no need of generating any adjustments for your look,
genuine win 7 keygen, set the VisZoomBehavior residence towards the VisZoomVisioExact worth, as demonstrated from the subsequent C# instance:Notice You can't resize the Visio drawing control inside a Word document. If you should resize the drawing manage and conserve the improvements, the handle will reset to its default size the next time the Word document is opened. Form Search Window Management You can "turn off" the Visio Shape Search window with the document's stencil pane making use of the Visio ItemFromID home. To create the Form Search window invisible inside stencil pane, set the property's Visible residence to bogus, that include:To expose the Form Search window inside stencil pane, set a similar value to Correct.Notice You can only control the visibility from the Form Search window on the per window foundation. Integrating Menus and Toolbars The most impressive practice when constructing an software employing the Visio drawing handle would be to put into action a customized UI. If you would like to exhibit Visio menus and toolbars within your container software, set the drawing control's NegotatiateToolbars and NegotiateMenus properties. The subsequent C# code enables both menu and toolbar merging:One of the best practice could be to set both of these properties to your exact same worth. The manage will not assistance independent negotiation of toolbars and menus. The container application should always support OLE menu merging so as to exhibit Visio menus or toolbars. One example is, you’re able to permit toolbar merging inside a Phrase document. Inside the Visual Basic venture in the Phrase document you’re able to programmatically show Visio toolbars. The following instance displays the Layout & Routing toolbar.Imperative Will not attempt menu and toolbar merging with multiple active situations of the ActiveX command. Various circumstances on the management share just one underlying Visio Software object. You may very well get unexpected benefits when trying to complete menu merging with just one Application object and different active occasions for the management. Critical Never merge menus and toolbars with all the Online Explorer consumer interface. There are known issues with menu merging in Online Explorer (see the Microsoft Knowledge Base guide 193098, PRB: Unexpected Menu Merging Behavior in Web-based Explorer). Menu and Toolbar Integration for Non-OLE Menu Merging Hosts If your container won't help OLE menu merging (such as, a Windows Form), you could utilize the IOleCommandTarget interface to run Visio commands. You can actually put into action your very own menu item or toolbar button as demonstrated from the following C# instance:Following you might have constructed your menu item, use your IOleCommandTarget interface to use the appropriate Visio user interface command for that target. The subsequent instance permits the Connector tool when a menu item is clicked:Dealing with Events For better utilization of Visio occasions, the Visio drawing handle object exposes all Visio Window and Document events. This permits developers to access the occasions directly in the handle instead that going through the Visio Document object.Mouse and keyboard occasions are commonly put into use with Visio management programming. You possibly can use mouse activities about the Visio drawing manage to show custom Windows Forms and update information on your host programs. If you should wish to "lock down" the Visio control's drawing surface and protect against end users from modifying any content specifically from the drawing, you can actually listen for all keyboard and mouse occasions and "throw them away." In the event the hosting software "swallows" the mouse and keyboard occasions, the Visio drawing surface will not react for the user's typing and mouse-click actions.Mouse and Keyboard Celebration Objects Function objects generated by the Visio AddAdvise approach offer the most beneficial performance. It is easy to utilize the Visio mouse and keyboard events like any other Visio function with AddAdvise. The following code sample demonstrates how to capture a mouse celebration applying an celebration sink in Visual Common six.0:The subsequent code sample demonstrates methods to generate an celebration object for your mouse event employing the AddAdvise methodology. Delegates for Mouse-Click Activities Though utilising event objects designed with AddAdvise supplies the most impressive performance, it's also possible to define a C# delegate in a Windows Kind to deal with mouse-click activities inside the drawing command window, as shown here:The event handler would then have the subsequent signature:Mouse Occasions for Designs Visio mouse occasions are uncovered on Page and Window objects. To locate a particular form inside of a page or window on which a consumer clicks, developers need to make use of the Visio SpatialSearch solution. The following C# code passes within the x- and y- coordinates for that click on function around the window, sets Visio constants that dictate the right way to set up the selection object, and defines a small tolerance in which to search around the x- and y- coordinates. If the tolerance is set to a very small unit relative to the size of your form, the selection object returned by the SpatialSearch way will only contain one shape, the one that the end user clicked on while in the window.Deployment The Visio drawing handle is distributed with the Visio solution Setup operation. Thus there are no increased licensing issues regarding the manage itself. An software that hosts the drawing management won't deliver the results unless Visio is installed on the laptop.The Visio drawing handle is installed as piece of the Minimal Set up option. If your software is created in managed code and helps make use of the Visio primary interop assemblies, it's essential to find the Typical Set up option if you want to install the Visio Primary interop assemblies. First of all, be sure that the personal pc has the .NET Framework 1.one installed; otherwise, the Visio Principal interop assemblies will never be installed. .NET Framework 1.one could be the version that's installed with Visual Studio .NET 2003. For clients running your software, you may also install the free .NET Framework 1.one Redistributable as component of the application's setup program.There are a couple options to deploy the Visio management drawing instantly through the Visio product or service setup: Create a Windows Installer setup plan and use "silent install" mode for corporate deployment. Get in touch with the Visio products Windows Installer bundle (the Visio .msi file) right. The following instance exhibits how you can utilize the Windows Script Host to silently install Visio making use of the Typical Install option:Conclusion The Visio drawing command lets developers to extend customized programs and alternatives with all the prosperous drawing functionality of Visio. By providing programmability for the handle and entry to the total Visio object product, the Visio part can be driven by both user drawing actions or activities and info while in the host software. The advantages of answers employing the Visio drawing control are: Customized application users usually do not need knowledge with the Visio user interface to make drawings. Your software UI can drive drawing creation and abstract away Visio-specific tasks from your user. Visio solution developers have a wider range of software hosts and choice of advancement instruments. The Visio drawing manage could very well be hosted within any ActiveX container. By by using the Visio Main interop assemblies,
microsoft office 2010 Home And Student code, you can also acquire solutions employing the Visio drawing management in managed code. Providing direct accessibility to your Visio programming product makes options implementing the Visio drawing manage simpler to cultivate and debug than alternatives that involve COM add-ins or VSLs. About the author Mark Bukovec is often a freelance developer and technical writer. Previously, Mark worked at Microsoft for five years, most recently being a program supervisor using the COM+ group. It is possible to contact Mark at empiredown@hotmail.com.